TCS interview experience Real time questions & tips from candidates to crack your interview

Digital Technology Intern

TCS
upvote
share-icon
3 rounds | 6 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 3 months
Topics: Data Structures, Algorithms, System Design, Aptitude, OOPS
Tip
Tip

Tip 1 : Must do Previously asked Interview as well as Online Test Questions.

Tip 2 : Go through all the previous interview experiences from Codestudio and Leetcode.

Tip 3 : Do at least 2 good projects and you must know every bit of them.


 

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

Tip 1 : Have at least 2 good projects explained in short with all important points covered.

Tip 2 : Every skill must be mentioned.

Tip 3 : Focus on skills, projects and experiences more.


 

Interview rounds

01
Round
Medium
Online Coding Interview
Duration150 minutes
Interview date10 Aug 2021
Coding problem3

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

1. Write a program to count all distinct pairs with difference equal to k

Moderate
0/80
Asked in companies
Goldman SachsOraclePhonePe

You are given with an array of integers and an integer K. You have to find and print the count of all such pairs which have difference K.

Note: Take absolute difference between the elements of the array.

Problem approach

1) Initialize count as 0
2) Sort all numbers in increasing order.
3) Remove duplicates from the array.
4) Do the following for each element arr[I]
    a) Binary Search for arr[i] + k in subarray from i+1 to n-1.
    b) If arr[i] + k found, increment count.
5) Return count.

Try solving now

2. Leaders in an array

Easy
15m average time
90% success
0/40
Asked in companies
AdobeMicrosoftQuikr

Given a sequence of numbers. Find all leaders in sequence. An element is a leader if it is strictly greater than all the elements on its right side.

Note:
1. Rightmost element is always a leader.

2. The order of elements in the return sequence must be the same as the given sequence
Example:
The given sequence is 13, 14, 3, 8, 2 .

13 Not a leader because on the right side 14 is greater than 13.

14 lt is a leader because no one greater element in the right side.

3 Not a leader because on the right side 8 are greater than 3.

8 It is a leader because no one greater element on the right side.

2 It is a leader because it is the rightmost element in a sequence.

Hence there are 3 leaders in the above sequence which are 14, 8, 2.
Problem approach

Scan all the elements from right to left in an array and keep track of maximum till now. When maximum changes its value, print it.

Try solving now

3. Sort an array in wave form

Easy
10m average time
85% success
0/40
Asked in companies
AmazonSAP LabsExpedia Group

You have been given an unsorted array ‘ARR’.

Your task is to sort the array in such a way that the array looks like a wave array.

Example:
If the given sequence ‘ARR’ has ‘N’ elements then the sorted wave array looks like - 
‘ARR[0] >= ARR[1]’ and ‘ARR[1] <= ARR[2]’
‘ARR[2] >= ARR[3]’ and ‘ARR[3] <= ARR[4]’
‘ARR[4] >= ARR[5]’ and ‘ARR[5] <= ARR[6]’  And so on.
Note:
1. ‘ARR[0]’ must be greater than or equal to ‘ARR[1]’.

2. There can be multiple arrays that look like a wave array but you have to return only one.

3. We have an internal function that will check your solution and return 'True' in case your array is one of the solutions otherwise return 'False'.

Explanation

The given array ‘ ARR = { 4, 3, 5, 2, 3, 1, 2 } ’
The below figure is a visual representation of the given ‘ARR’ and you can see we can express ‘ARR’ in a waveform array because 
4>3 and 3<5 
5>2 and 2<3
3>1 and 1<2
And it follows the condition of wave array.

subsequence

Follow up:
Try to solve this problem in linear time complexity.
Problem approach

The idea is based on the fact that if we make sure that all even positioned (at index 0, 2, 4, ..) elements are greater than their adjacent odd elements, we don’t need to worry about odd positioned element. Following are simple steps. 

1) Traverse all even positioned elements of input array, and do following. 
….a) If current element is smaller than previous odd element, swap previous and current. 
….b) If current element is smaller than next odd element, swap next and current.

Try solving now
02
Round
Easy
Video Call
Duration30 minutes
Interview date5 Sep 2021
Coding problem2

This round had 2 coding questions followed by some questions from DBMS

1. Check whether two given strings are anagram of each other or not

Moderate
30m average time
60% success
0/80
Asked in companies
AdobeThought WorksHSBC

You are given two strings 'str1' and 'str1'.


You have to tell whether these strings form an anagram pair or not.


The strings form an anagram pair if the letters of one string can be rearranged to form another string.

Pre-requisites:

Anagrams are defined as words or names that can be formed by rearranging the letters of another word. Such as "spar" can be formed by rearranging letters of "rasp". Hence, "spar" and "rasp" are anagrams. 

Other examples include:

'triangle' and 'integral'
'listen' and 'silent'
Note:
Since it is a binary problem, there is no partial marking. Marks will only be awarded if you get all the test cases correct. 
Problem approach

This method assumes that the set of possible characters in both strings is small. In the following implementation, it is assumed that the characters are stored using 8 bit and there can be 256 possible characters. 

Create count arrays of size 256 for both strings. Initialize all values in count arrays as 0.
Iterate through every character of both strings and increment the count of character in the corresponding count arrays.
Compare count arrays. If both count arrays are same, then return true.

Try solving now

2. Find Duplicates In Array

Easy
15m average time
90% success
0/40
Asked in companies
OYOIBMAcko

You are given an array/list 'ARR' consisting of N integers, which contains elements only in the range 0 to N - 1. Some of the elements may be repeated in 'ARR'. Your task is to find all such duplicate elements.

Note:
1. All the elements are in the range 0 to N - 1.
2. The elements may not be in sorted order.
3. You can return the duplicate elements in any order.
4. If there are no duplicates present then return an empty array.
Problem approach

The idea is to use Hashing to solve this in O(n) time on average. We can store elements and their counts in a hash table. After storing counts, traverse input array again and print those elements whose counts are more than once. To make sure that every output element is printed only once, we can set count as 0 after printing the element.

Try solving now
03
Round
Easy
HR Round
Duration20 minutes
Interview date5 Sep 2021
Coding problem1

This was a Technical Cum HR round where I was first asked some basic Java-related concepts and then we discussed about my expectations from the company, learnings and growth in the forthcoming years. I would suggest be honest and try to communicate your thoughts properly in these type of rounds to maximise your chances of getting selected.

1. Basic HR Questions

1) Why should we hire you?
2) What are your expectations from the company?
3) How was your overall interview experience?
4) What are your strengths and weakness according to you?
5) Where do you see yourself in the next 5 years?

Problem approach

Tip 1 : The cross-questioning can go intense sometimes, think before you speak.
Tip 2 : Be open-minded and answer whatever you are thinking, in these rounds, I feel it is important to have an opinion.
 

Here's your problem of the day

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

Skill covered: Programming

How do you remove whitespace from the start of a string?

Choose another skill to practice
Similar interview experiences
SDE - 1
2 rounds | 4 problems
Interviewed by TCS
0 views
0 comments
0 upvotes
Digital Technology Intern
2 rounds | 2 problems
Interviewed by TCS
846 views
0 comments
0 upvotes
Assistant System Engineer
3 rounds | 7 problems
Interviewed by TCS
953 views
0 comments
0 upvotes
TCS Ninja
3 rounds | 5 problems
Interviewed by TCS
1053 views
0 comments
0 upvotes