Tech Mahindra Pvt. Ltd interview experience Real time questions & tips from candidates to crack your interview

SDE - 1

Tech Mahindra Pvt. Ltd
upvote
share-icon
2 rounds | 6 Coding problems

Interview preparation journey

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

Tip 1 : Solve RS Aggarwal Aptitude and Problem Solving Books.
Tip 2 : Practice Coding questions from prepInsta.
Tip 3 : Worked on communication skills

Application process
Where: Campus
Eligibility: No criteria
Resume Tip
Resume tip

Tip 1 : Mark skills with Bold letters.
Tip 2 : Mention projects on resume

Interview rounds

01
Round
Medium
Online Coding Test
Duration90 minutes
Interview date16 Mar 2022
Coding problem5

- Morning time
- Environment was good.
- No
- Interviewer was good

1. Longest Prefix Which is Suffix

Moderate
0/80
Asked in companies
Expedia GroupFlipkart limited

You are given a string ‘str’.


Find the longest prefix in the string which is also a suffix of the string, excluding the string itself.


If there's no such string return an empty string "".


Example:
Input: ‘str’ = ‘ababcdabab’ 

Output: 'abab'

Explanation:
Here the prefix ‘abab’ is equal to the suffix ‘abab’. The length of the prefix is 4. There's no other prefix that has length > 4 and is also present as a suffix. Hence the answer is 'abab'. 
Try solving now

2. Minimum Sum in matrix

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

You are given a 2D matrix ‘ARR’ of size ‘N x 3’ having integers, where ‘N’ is the number of rows.

Your task is to find the smallest sum possible while taking one element from each row.

The rules for selecting elements are as follows-

1. In a row, after selecting an element at a given position, you cannot select the element directly below it
2. You can only select elements that are not directly below the previously selected element.
Try solving now

3. Minimum Number of Increments on Subarrays to Form a Target Array

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

You are given two arrays “initial” and “final”. All the elements in the array “initial” are zero initially. And all the elements of the array “final” are positive integers.

You have to find the minimum number of operations to convert the “initial” array into the “final” array using the following operation:

1. In one operation, you can select any contiguous subsequence of the “initial” array and increment each value by 1.

Note :

A contiguous subsequence of a list S is a subsequence made up of consecutive elements of S. If S is {5, 15, -30, 10, -5, 40, 10} then 15, -30, 10 is a contiguous subsequence.
Try solving now

4. Unequal Adjacent Elements

Moderate
25m average time
75% success
0/80
Asked in companies
WalmartHashedInTrilogy Innovations

You have been given an array/list ‘ARR’ of integers consisting of ‘N' integers. You need to rearrange ‘ARR’ so that no two adjacent elements are equal. You may return any valid rearrangement and it is guaranteed the answer exists.

Example :
Let’s say you have an array/list ‘ARR = [1,1,2,2]’. 

Then a valid rearrangement can be [1,2,1,2] or [2,1,2,1] such that no two adjacent elements are equal. [2,1,1,2] is an invalid arrangement because two adjacent elements are equal.
Try solving now

5. Number of operations to make Graph connected.

Easy
15m average time
86% success
0/40
Asked in companies
MicrosoftFacebookUber

You have been given a graph consisting of ‘N’ vertices numbered from 1 to ‘N’. The graph has ‘M’ edges. In an operation, you can shift an edge between two directly connected vertices to between pair of disconnected vertices to make them directly connected. Return the minimum number of operations to make the graph connected. If it is not possible to make graph connected return -1.

Example:
Let’s say ‘N’ is 4 and ‘M' is 3. The 3 edges are (1,2), (2,3) and (1,3). Then our graph will look as follows:-

subsequence

To make the graph connected we can shift the edge between (1,3) to (1,4). This operation will make the graph connected. There are multiple ways in which we can make graph connected. So, in this case, we can make graph connected in just one operation.
Note:
1. A connected graph is a graph that is connected in the sense of a topological space, i.e., there is a path from any vertex to any other vertex in the graph.

2. There are no repeated edges and self-loops in the graph.

3. You do not need to print anything; it has already been taken care of. Just implement the function.
Try solving now
02
Round
Easy
HR Round
Duration20 Minutes
Interview date12 May 2022
Coding problem1

- Morning time
- Environment was good.
- No
- Interviewer was good

1. Basic HR Questions

1- What is the biggest challenge you’ve faced in your current position?
2- How would your coworkers describe you?
3- What skills would you bring to the job?
4- Tell me about yourself?

Problem approach

Tip 1 : Communicate well with HR
Tip 2 : Practice as much as you can

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 | 2 problems
Interviewed by Tech Mahindra Pvt. Ltd
1673 views
0 comments
0 upvotes
SDE - 1
3 rounds | 3 problems
Interviewed by Tech Mahindra Pvt. Ltd
1413 views
0 comments
0 upvotes
Senior Software Engineer
3 rounds | 3 problems
Interviewed by Tech Mahindra Pvt. Ltd
2225 views
0 comments
0 upvotes
SDE - 1
2 rounds | 3 problems
Interviewed by Tech Mahindra Pvt. Ltd
1117 views
2 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Amazon
115096 views
24 comments
0 upvotes
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Microsoft
58237 views
5 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Amazon
35146 views
7 comments
0 upvotes