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

SDE - 1

Tata1mg
upvote
share-icon
4 rounds | 8 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 3.5 Months
Topics: Data Structures, OOPS, Algorithms, Dynamic Programming, Database Management, Operating System, Aptitude.
Tip
Tip

Tip 1 : Do at least 2-3 Development Projects as it creates a great impression. 
Tip 2 : Do it simply don't include complex terms to explain anything/concept. 
Tip 3 : Practice as many questions as you can.

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

Tip 1 : Resume should be one page only as being a fresher impacts a lot.
Tip 2 : Resumes should contain all the links for projects and certificates as it impresses the interviewer.

Interview rounds

01
Round
Medium
Online Coding Test
Duration60 Minutes
Interview date2 Dec 2021
Coding problem2

It has 3 Coding Questions of medium-hard level and the time limit was 1 hour only. I don’t exactly remember the questions but I was able to do only two of them completely.

1. Form the Biggest Number

Moderate
25m average time
70% success
0/80
Asked in companies
BarclaysArcesiumIntuit

Given an array “A” of positive integers. Your task is to make the largest number possible formed by concatenating each of the array elements exactly once.

Example:
Let's say the given array is [ 9, 98, 7].

All the possible numbers formed by concatenating each of the array elements are 7989,7998,9879,9897,9987,9798. Among the six numbers, 9987 is the greatest number. Hence the answer is 9987.
Problem approach

Using the inbuilt library of Python, itertools library can be used to perform this task.

Try solving now

2. Number of Longest Increasing Subsequence

Moderate
0/80
Asked in companies
AmazonSamsungTata1mg

Given an integer array ‘arr’ of length ‘n’, return the number of longest increasing subsequences in it.


The longest increasing subsequence(LIS) is the longest subsequence of the given sequence such that all subsequent elements are in strictly increasing order.


Example:
Input: ‘n’ = 5, ‘arr’ = [50, 3, 90, 60, 80].

Output: 2

Explanation: 
In this array, the longest increasing subsequences are [50, 60, 80] and [3, 60, 80]. 

There are other increasing subsequences as well, but we need the number of the longest ones. Hence the answer is 2.
Problem approach

Querying the length of the longest is fairly easy. Note that we are dealing with end elements only. We need not maintain all the lists. We can store the end elements in an array. Discarding operation can be simulated with replacement, and extending a list is analogous to adding more elements to the array.
We will use an auxiliary array to keep end elements. The maximum length of this array is that of input. In the worst case the array is divided into N lists of size one (note that it doesn’t lead to worst-case complexity). To discard an element, we will trace ceil value of A[i] in the auxiliary array (again observe the end elements in your rough work), and replace ceil value with A[i]. We extend a list by adding elements to the auxiliary array. We also maintain a counter to keep track of auxiliary array length.

Try solving now
02
Round
Medium
Telephonic
Duration60 Minutes
Interview date6 Dec 2021
Coding problem3

First, the interviewer introduced himself and then asked to introduce myself. Then he asked about the projects I did. After an introductory discussion on projects, he gave me 3 coding questions on their personal live code environment.

He asked me to explain the approach first and then code it down. I had to explain the time complexity of each solution and optimal code if possible with lesser time complexity.

1. Find the elements value if present in the cache.

Hard
35m average time
65% success
0/120
Asked in companies
alibabaTata1mg

There is a cache that can hold up to ‘N’ elements. Initially, it is empty. There are two types of operations:-

Operation 1: [ 1 ‘U_ID’ ‘VAL’ ] - where 1 represents an insert/update operation is being performed in the cache.

If the element with a particular ‘U_ID’ already exists in cache:
 - Update its mapped value with ‘VAL’. 

If it does not exist and the cache is not full then 
 - Simply insert this element. 

If it does not exist and the cache is already full then 
 - We remove an element and insert this element into the cache. The element to be removed is selected as the least frequently used element.
Note:
  1) The frequency of use of an element is calculated by a number of operations with its ‘U_ID’ performed after it is inserted in the cache.

  2) If multiple elements have the least frequency then we remove the element which was least recently used. 

Operation 2: [ 2 'UID' ] - where 2 represents, mapped value of this 'UID'

If present in cache otherwise return -1.

You have been given ‘M’ operations which you need to perform in the cache. Your task is to return a vector/list that contains the answer of all the operations of type 2 and in the order in which they were asked.

Example:
We perform the following operations on an empty cache which has capacity 2:

When operation 1 2 3 is performed, the element with 'U_ID' 2 and value 3 is inserted in the cache.

When operation 1 2 1 is performed, the element with 'U_ID' 2’s value is updated to 1.  

When operation 2 2 is performed then value of 'U_ID' 2 is returned i.e. 1.

When operation 2 1 is performed then the value of 'U_ID' 1 is to be returned but it is not present in cache therefore -1 is returned.

When operation 1 1 5 is performed, the element with 'U_ID' 1 and value 5 is inserted in the cache. 

When operation 1 6 4 is performed, the cache is full so we need to delete an element.First, we check the number of times each element is used. Element with 'U_ID' 2 is used 3 times (2 times operation of type 1 and 1-time operation of type 1). Element with 'U_ID' 1 is used 1 time (1-time operation of type 1). So element with 'U_ID' 1 is deleted. The element with 'U_ID' 6 and value 4 is inserted in the cache. 
Try solving now

2. Possible Words From A Phone Number

Hard
55m average time
45% success
0/120
Asked in companies
MicrosoftFacebookExpedia Group

After years of research, Ninja is finally able to invent the time machine, and now he is back to the good old days when T9 keypads were being used in mobile phones.

Being a curious person, Ninja wants to find out all possible strings that can be formed by pressing the keys of the phone.

Formally, you are given a string S, that consists of digits from 2-9 (both inclusive), your task is to find out all the possible strings that can be formed from the input string by mapping the digits to the letters as in a T9 keypad. Then, print the strings in a lexicographically sorted order.

T9_Keypad

For Example:
If S = “34”, then all the possible letters that can be formed from string S are {“dg”, “dh”, “di”, “eg”, “eh”, “ei”, “fg”, “fh”, “fi”}.
Problem approach

I explained to him the logic of my approach and he seems satisfied with it. It was sort of medium-level difficulty.

Try solving now

3. Shortest Unique Prefix

Moderate
15m average time
85% success
0/80
Asked in companies
OlaJUSPAYTata1mg

You are given an array containing ‘N’ words. For each word, you need to find its shortest prefix which can uniquely identify it. For example “abcd” and “abdc” both have the prefix “ab” in common so we can’t uniquely find a word using the prefix “ab”. To uniquely identify both the words we need the prefix “abc” from “abcd” and “abd” from “abdc”.

Note:
You can assume that the words are unique. It means that it is always possible to find a unique prefix for each word.
Problem approach

I gave him a brute force approach with which he was not satisfied. Then he gave me time to think and asked for more optimized approach. Then after 5 min i gave him this Trie solution and then i explained him the structure of trie along with the code

Try solving now
03
Round
Hard
Telephonic
Duration60 Minutes
Interview date6 Dec 2021
Coding problem2

In this round interviewer gave me 2 coding questions and asked me to code on any editor of my choice. I opened VS code to code those problems.

1. Maximum Subarray Sum

Moderate
35m average time
81% success
0/80
Asked in companies
HCL TechnologiesInformaticaSamsung

You are given an array 'arr' of length 'n', consisting of integers.


A subarray is a contiguous segment of an array. In other words, a subarray can be formed by removing 0 or more integers from the beginning and 0 or more integers from the end of an array.


Find the sum of the subarray (including empty subarray) having maximum sum among all subarrays.


The sum of an empty subarray is 0.


Example :
Input: 'arr' = [1, 2, 7, -4, 3, 2, -10, 9, 1]

Output: 11

Explanation: The subarray yielding the maximum sum is [1, 2, 7, -4, 3, 2].
Problem approach

I explained to him my approach (Kadane’s algorithm) and he seems satisfied with it and asked to code it down.

Try solving now

2. LRU Cache Implementation

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

Design and implement a data structure for Least Recently Used (LRU) cache to support the following operations:

1. get(key) - Return the value of the key if the key exists in the cache, otherwise return -1.

2. put(key, value), Insert the value in the cache if the key is not already present or update the value of the given key if the key is already present. When the cache reaches its capacity, it should invalidate the least recently used item before inserting the new item.
You will be given ‘Q’ queries. Each query will belong to one of these two types:
Type 0: for get(key) operation.
Type 1: for put(key, value) operation.
Note :
1. The cache is initialized with a capacity (the maximum number of unique keys it can hold at a time).

2. Access to an item or key is defined as a get or a put operation on the key. The least recently used key is the one with the oldest access time.
Problem approach

I gave him a brute force solution but the interviewer was not satisfied. I was stuck for some time, then he helped me with data structure (doubly linked list). After 15-20 min of discussion, I was able to do that question and code it down.

Try solving now
04
Round
Easy
HR Round
Duration40 Minutes
Interview date7 Dec 2021
Coding problem1

The interviewer was very friendly. He asked me about myself and previous interviews.

1. Technical Questions

He jumped on my projects. I explained to him and answered all the follow-up questions
After sharing the link to the 1MG website and asked me to design DB for it. He gave me 5-10 min to think and design DB.
Finally, in the end, he asked me standard HR-type questions like where do you see yourself in 2 years, a startup with 2X salary or a stable company with X salary, why you want to join us, etc.

Problem approach

Tip 1 : Listen to the question carefully and clear all your doubts at the same time before proceeding to a solution.
Tip 2 : Even If you are stuck, discuss your thinking process with the interviewer. They can help you with some hints.
Tip 3 : Prepare HR questions before coming to interviews.

Here's your problem of the day

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

Skill covered: Programming

What is recursion?

Choose another skill to practice
Similar interview experiences
SDE - 1
4 rounds | 5 problems
Interviewed by Tata1mg
4932 views
0 comments
0 upvotes
SDE - 1
3 rounds | 5 problems
Interviewed by Tata1mg
1312 views
0 comments
0 upvotes
SDE - 1
1 rounds | 3 problems
Interviewed by Tata1mg
1636 views
1 comments
0 upvotes
SDE - 1
4 rounds | 12 problems
Interviewed by Tata1mg
0 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Amazon
114579 views
24 comments
0 upvotes
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Microsoft
57825 views
5 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Amazon
34961 views
7 comments
0 upvotes