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

SDE - 1

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

Interview preparation journey

expand-icon
Preparation
Duration: 10 months
Topics: Aptitude, OOPS, OS, DBMS, CN, SQL, Data structures and Algorithms
Tip
Tip

Tip 1 : Prepare aptitude if you are applying for TCS
Tip 2 : Have strong knowledge of DSA

Application process
Where: Company Website
Eligibility: above 7 CGPA
Resume Tip
Resume tip

Tip 1 : Have projects in your resume
Tip 2 : Be real about your knowledge

Interview rounds

01
Round
Hard
Online Coding Interview
Duration180 minutes
Interview date16 Aug 2021
Coding problem2

1. Nth Fibonacci Number

Easy
0/40
Asked in companies
IBMSAP LabsAccenture

The n-th term of Fibonacci series F(n), where F(n) is a function, is calculated using the following formula -

    F(n) = F(n - 1) + F(n - 2), 
    Where, F(1) = 1, F(2) = 1


Provided 'n' you have to find out the n-th Fibonacci Number. Handle edges cases like when 'n' = 1 or 'n' = 2 by using conditionals like if else and return what's expected.

"Indexing is start from 1"


Example :
Input: 6

Output: 8

Explanation: The number is ‘6’ so we have to find the “6th” Fibonacci number.
So by using the given formula of the Fibonacci series, we get the series:    
[ 1, 1, 2, 3, 5, 8, 13, 21]
So the “6th” element is “8” hence we get the output.
Problem approach

Step 1 : Think of brute force method
Step 2 : Further optimised in DP
Step 3 : Did more space optimisation

Try solving now

2. Longest Common Subsequence

Moderate
39m average time
0/80
Asked in companies
PayPalShareChatOla

Given two strings, 'S' and 'T' with lengths 'M' and 'N', find the length of the 'Longest Common Subsequence'.

For a string 'str'(per se) of length K, the subsequences are the strings containing characters in the same relative order as they are present in 'str,' but not necessarily contiguous. Subsequences contain all the strings of length varying from 0 to K.

Example :
Subsequences of string "abc" are:  ""(empty string), a, b, c, ab, bc, ac, abc.
Problem approach

Step 1 : The call of recursive will return the LCS (largest common subsequence) of s.substring(i) and t.substring(j), where s.substring(i) is the suffix of s starting at index i.
If the indexes are large enough, at least one of the strings is empty. So no common subsequence exists. Return 0.
Step 2 : If s.charAt(i) == t.charAt(j), then we have found a common character. So whatever subsequence the strings s.substring(i+1) and t.substring(j+1) may have in common, we know how to extend that sequence by 1 character.
Step 3 : Otherwise, we can not really be sure whether it is a good idea to skip one character of s or of t. So we try both via recursion, and take the better result (the maximum).
Step 4 : Now optimised in Memoization

Try solving now
02
Round
Medium
Face to Face
Duration30 minutes
Interview date1 Sep 2021
Coding problem4

1. Second largest element in the array

Easy
15m average time
80% success
0/40
Asked in companies
AdobeTata Consultancy Services (TCS)Samsung

You have been given an array/list 'ARR' of integers. Your task is to find the second largest element present in the 'ARR'.

Note:
a) Duplicate elements may be present.

b) If no such element is present return -1.
Example:
Input: Given a sequence of five numbers 2, 4, 5, 6, 8.

Output:  6

Explanation:
In the given sequence of numbers, number 8 is the largest element, followed by number 6 which is the second-largest element. Hence we return number 6 which is the second-largest element in the sequence.
Problem approach

Step 1 : I give brute force answer which required O(n^2) time complexity.
Step 2 : I further give o(n) approach which required two variables solution.

Try solving now

2. Swap Two Numbers

Easy
10m average time
0/40
Asked in companies
CIS - Cyber InfrastructureGenpactPaytm (One97 Communications Limited)

You are given two numbers 'a' and 'b' as input.


You must swap the values of 'a' and 'b'.


For Example:
Input: 
'a' = 8, 'b' = 5

Output:
5 8

Explanation:
Initially, the value of 'a' and 'b' is 8 and 5, respectively.

After swapping, the value of 'a' is 5, and the value of 'b' is 8.
Problem approach

Step 1 : I took little time for doing pen paper.
Step 2 : After that my solution is ready I tell the interviewer about my code.

Try solving now

3. DBMS Question

What is Joins?

What are Natural Joins?

4. SQL Questions

Do you know SQL commands?

Write a SQL Query to obtain the employee list which have more than 4 leaves in one month?

03
Round
Easy
HR Round
Duration20 minutes
Interview date7 Sep 2021
Coding problem1

1. Basic HR Questions

Introduction and Projects

Location Preference

Able to work in night shift?

Are you aware of bond?

Why do you want to join TCS?

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 - 1
3 rounds | 5 problems
Interviewed by Tata Consultancy Services (TCS)
1842 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 7 problems
Interviewed by Tata Consultancy Services (TCS)
1283 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 6 problems
Interviewed by Tata Consultancy Services (TCS)
1473 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 7 problems
Interviewed by Tata Consultancy Services (TCS)
1595 views
3 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
2 rounds | 3 problems
Interviewed by BNY Mellon
6240 views
3 comments
0 upvotes
company logo
SDE - 1
3 rounds | 6 problems
Interviewed by BNY Mellon
0 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 3 problems
Interviewed by Accenture
2487 views
0 comments
0 upvotes