Tata Consultancy Services (TCS) interview experience Real time questions & tips from candidates to crack your interview

SDE

Tata Consultancy Services (TCS)
upvote
share-icon
3 rounds | 5 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 3 months
Topics: DS algo , OOPS , DP questions , Aptitude , System Design , Operating System
Tip
Tip

Tip 1 : Do not only read, practice!
Tip 2 : Take notes of your mistakes 
Tip 3 : give at least 1 hour every day

Application process
Where: Campus
Eligibility: 6.5 CGPA
Resume Tip
Resume tip

Tip 1 : You should include meaningful projects
Tip 2 : Add only those skills at which you are proficient.
Tip 3 : It should be to the point.

Interview rounds

01
Round
Medium
Online Coding Interview
Duration120-180 minutes
Interview date10 Aug 2021
Coding problem2

English MCQs
Quantitative + Aptitude Mcqs
Coding round (60 minutes)

1. Dijkstra's shortest path

Moderate
25m average time
65% success
0/80
Asked in companies
AmazonPhonePeHexaware Technologies

You have been given an undirected graph of ‘V’ vertices (labeled 0,1,..., V-1) and ‘E’ edges. Each edge connecting two nodes (‘X’,’Y’) will have a weight denoting the distance between node ‘X’ and node ‘Y’.

Your task is to find the shortest path distance from the source node, which is the node labeled as 0, to all vertices given in the graph.

Example:

Input:
4 5
0 1 5
0 2 8
1 2 9
1 3 2
2 3 6

alt text

In the given input, the number of vertices is 4, and the number of edges is 5.

In the input, following the number of vertices and edges, three numbers are given. The first number denotes node ‘X’, the second number denotes node ‘Y’ and the third number denotes the distance between node ‘X’ and ‘Y’.

As per the input, there is an edge between node 0 and node 1 and the distance between them is 5.

The vertices 0 and 2 have an edge between them and the distance between them is 8.
The vertices 1 and 2 have an edge between them and the distance between them is 9.
The vertices 1 and 3 have an edge between them and the distance between them is 2.
The vertices 2 and 3 have an edge between them and the distance between them is 6.

Note:

1. There are no self-loops(an edge connecting the vertex to itself) in the given graph.

2. There can be parallel edges i.e. two vertices can be directly connected by more than 1 edge.
Problem approach

The first line contains the number of test cases, T = 2.

The first test case

Given

N = 4
M = 1
A = [ [1, 3, 10] ]
Approach

Since by taking the first train one can only travel from any city between 1 and 3. There is no way to reach city 4. 
Thus, the answer is -1.
The second test case

Given

N = 4
M = 3
A = [ [1, 4, 10], [1, 2, 5], [2, 4, 3] ].
Approach

First, take the second train from city 1 and reach city 2 at a cost of 5.
Then, take the third train from city 2 and reach city 4 at a cost of 3.
Thus, the total cost is 5+3 = 8.

Try solving now

2. Maximum Subarray Sum Queries

Hard
45m average time
55% success
0/120
Asked in companies
ShareChatTata Consultancy Services (TCS)Freshworks

Given an array of ‘N’ integers and ‘Q’ queries. The query is defined as below :-

Given 2 integers ‘l’ and ‘r’ (‘l’ >= 0 and ‘r’ < N) find the maximum subarray sum between ‘l’ to ‘r’ (Inclusive).

Query( ‘l’ ,’r’) = max(arr[i] + arr[i+1] +...arr[j].( i >= ‘l’ and j <= ‘r’)

Try solving now
02
Round
Easy
Face to Face
Duration20 minutes
Interview date7 Sep 2021
Coding problem2

1. Alice and her love for Strings

Easy
10m average time
90% success
0/40
Asked in companies
AdobeTata Consultancy Services (TCS)Cognizant

Alice loves string and Bob being her best friend wants to gift a beautiful string to Alice on her birthday. He knows that Alice loves her childhood string ‘A’ and would love to get a new string similar to the string ‘A’.

Somehow Bob convinced one of his friends to send him a random string ‘B’. Now Bob will have to change the random string ‘B’ to make it equal to string ‘A’ so that he can gift this string to Alice on her birthday. But changing the string is a very tedious process. He can change one character of the string to any other character in a single step.

Now he wonders if it is even possible to change the string ‘B’ to string ‘A’ by using at most ‘K’ steps? Can you help Bob figure out if it is even possible to do so under given constraints?

Problem approach

Given

N = 5
Strings are ["aaa", "hack", "zzz", "abcd", "szxp"]
Approach

There must be a minimum of 3 strings that Alice could have started with to end up with the given final array. Note that "aaa" and "zzz" are encodings of each other, so at least one of them must have been present in the original array. Similarly, at least one of "hack" and "szxp" must have been present. "abcd" does not have its encoding in the final array so it is guaranteed to be present in the original array and did not get encoded.

Here are all the 9 ways that Alice could have ended up with the final array:

Alice started with 5 strings: ["aaa", "hack", "zzz", "abcd", "szxp"] and none of them got encoded.
Alice started with 4 strings: ["aaa", "hack", "abcd", "szxp"] and only "aaa" got encoded to "zzz".
Alice started with 4 strings: ["zzz", "hack", "abcd", "szxp"] and only "zzz" got encoded to "aaa".
Alice started with 4 strings: ["zzz", "hack", "abcd", "aaa"] and only "hack" got encoded to "szxp".
Alice started with 4 strings: ["zzz", "szxp", "abcd", "aaa"] and only "szxp" got encoded to "hack".
Alice started with 3 strings: ["aaa", "szxp", "abcd"] with "aaa" and "szxp" getting encoded to "zzz" and "hack" respectively.
Alice started with 3 strings: ["zzz", "szxp", "abcd"] with "zzz" and "szxp" getting encoded to "aaa" and "hack" respectively.
Alice started with 3 strings: ["aaa", "hack", "abcd"] with "aaa" and "hack" getting encoded to "zzz" and "szxp" respectively.
Alice started with 3 strings: ["zzz", "hack", "abcd"] with "zzz" and "hack" getting encoded to "aaa" and "szxp" respectively.
The minimum number of strings Alice could have started with is 3, so the answer is 3

Try solving now

2. Gold mine problem

Moderate
35m average time
70% success
0/80
Asked in companies
Tata Consultancy Services (TCS)Goldman SachsAmazon

You have been given a gold mine represented by a 2-d matrix of size ('N' * 'M') 'N' rows and 'M' columns. Each field/cell in this mine contains a positive integer, the amount of gold in kgs.

Initially, the miner is at the first column but can be at any row.

He can move only right, right up, or right down. That is from a given cell and the miner can move to the cell diagonally up towards the right or right or diagonally down towards the right.

Find out the maximum amount of gold he can collect.

Problem approach

In the first test case, player 1 will move from (3,2)->(1,1) and the second player will move from (3,4)->(1,4).

In the second test case, player 1 will move from (3,4)->(2,4)->(1,4) and the second player doesn't move.

Try solving now
03
Round
Easy
HR Round
Duration10 minutes
Interview date7 Sep 2021
Coding problem1

1. Basic HR Questions

Tell us about your strength and weakness.

Where do you see yourself in 5 years?

What if a person having the same experience as you have a higher position? Your thoughts on that.




 

Problem approach

Tip 1 : Answer the weaknesses as your strength.
Tip 2 : Be confident.
Tip 3 : Explain using STAR analysis.

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

To make an AI less repetitive in a long paragraph, you should increase:

Choose another skill to practice
Similar interview experiences
company logo
SDE
2 rounds | 3 problems
Interviewed by Tata Consultancy Services (TCS)
1039 views
0 comments
0 upvotes
company logo
SDE
3 rounds | 6 problems
Interviewed by Tata Consultancy Services (TCS)
1584 views
0 comments
0 upvotes
company logo
SDE
3 rounds | 6 problems
Interviewed by Tata Consultancy Services (TCS)
999 views
0 comments
0 upvotes
company logo
SDE
2 rounds | 6 problems
Interviewed by Tata Consultancy Services (TCS)
2132 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE
4 rounds | 6 problems
Interviewed by HashedIn
710 views
0 comments
0 upvotes
company logo
SDE
2 rounds | 4 problems
Interviewed by Cognizant
918 views
0 comments
0 upvotes
company logo
SDE
2 rounds | 4 problems
Interviewed by HCL Technologies
989 views
0 comments
0 upvotes