Tech Mahindra Super Coder Questions and Answers

Tech Mahindra Super Coder Questions with Solutions

Tech Mahindra Coding Questions and Answers are discussed on this page, which were asked in the Coding Assessment and Technical Interviews of the company for hiring the Tech Mahindra Super Coder.

Here we have mentioned other details related to Tech Mahindra recruitment processes like Job profiles, CTC offered, and Steps involved in Recruitment Process to hire Tech Mahindra Super Coder. 

Tech-Mahindra-Coding-Questions

About Tech Mahindra

Tech Mahindra is a multinational information technology (IT) company based in India. It was founded in 1986 and is part of the Mahindra Group.

Tech Mahindra offers a range of IT services, including software development, system integration, network management, data analytics, and digital transformation solutions. It serves clients in various sectors such as banking and financial services, telecommunications, healthcare, manufacturing, retail, and transportation.

About Tech Mahindra Recruitment Process 2024

Tech Mahindra announced the hiring of freshers for 2 Job Profiles – Assistant Engineer and Super Coder. For the Assistant Engineer post we have mentioned the following steps:

  1. Online Aptitude Test
  2. Psychometric Test
  3. Technical Test
  4. HR Interview

After clearing these rounds Tech Mahindra is inviting the candidates to participate in Super Coder Contest.

We have mentioned further details of the Tech Mahindra Super Coder Recruitment Process in the following Tabular Form
Tech Mahindra Related Information
Position: Super Coder
Course:
  • B.E./B.Tech, M.E./M.Tech, MCA, M.Sc (Computer science)
  • Eligible Batch – 2024
Eligibility Criteria / Academic Qualification Required:
  • 70 % or above in 10th & 12th
  • 7.4 CGPA OR equivalent percentage is required in Graduation / Post Graduation.
  • No Current Backlogs.
CTC Offered:
  • For Super Coder = ₹ 5.50 L.P.A
Selection Process:
  1. Performance Evaluation of Coding Test attempted for Assistant Engineer Post.
  2. HackerEarth Coding Test.
  3. Technical Interview
Test Duration:

1 Hour 30 Minutes

Use Coupon Code “CT10” and get flat 10% OFF on your Prime Subscription :

  • 1 month extra subscription on 3 & 6 months plans
  • 2 months extra subscription on 12 & 24 months plans
  • 3 months extra subscription on 36 & 48 months plan

(Use Coupon Code “CT10″ and get 10% off and additional months)

Prime Course Trailer

Related Banners

Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription

Tech Mahindra Super Coder Questions with Solutions

Question 1 : Buying Stocks

You are given a list of daily prices of a stock. You can buy a stock on one day and sell it later on another day after the day you bought the stock. You can perform the above operation only once. What is the maximum loss possible?

Example

Prices=[10,4,2,9]

The greatest loss is incurred when you buy at a price of 10 and sell at a price of 2. Return the difference:9.

Example

Price=[1,2,3,4]

The Price went up every day. Return 0.

Sample Input for Custom Testing

STDIN                   Function

———–               ————–

  •    7   → Prices []  size n=7
  •    1 →       prices =[1,8,4,2,10,3,2]
  •    8
  •    4
  •    2
  •   10
  •    3
  •    2

Sample Output

  •   8

Explanation

Using zero-based index notation, the correct answer is a[4]-a[6]=10-2=8. There is a greater difference between 10 and 1 but that would imply selling before buying, and short selling is not allowed in this problem.

Question 2: k th largest factor of N

Problem Description:
A positive integer d is said to be a factor of another positive integer N if when N is divided by d, the remainder obtained is zero. For example, for number 12, there are 6 factors 1, 2, 3, 4, 6, 12. Every positive integer k has at least two factors, 1 and the number k itself. Given two positive integers N and k, write a program to print the kth largest factor of N.

Input Format: The input is a comma-separated list of positive integer pairs (N, k).

Output Format: The kth highest factor of N. If N does not have k factors, the output should be 1.

Constraints:

  • 1<N<10000000000
  • 1<k<600.

You can assume that N will have no prime factors which are larger than 13.

Example 1

  • Input: 12,3
  • Output: 4

Explanation: N is 12, k is 3. The factors of 12 are (1,2,3,4,6,12). The highest factor is 12 and the third largest factor is 4. The output must be 4.

Example 2

  • Input: 30,9
  • Output: 1

Explanation: N is 30, k is 9. The factors of 30 are (1,2,3,5,6,10,15,30). There are only 8 factors. As k is more than the number of factors, the output is 1.

Question 3: Street Light Installation

Street Lights are installed at every position along a 1-D road of length n.

Locations[] (an array) represent the coverage limit of these lights. The ith light has a coverage limit of locations[i] that can range from the position max((i – locations[i]), 1) to min((i + locations[i]), n ) (Closed intervals). Initially all the lights are switched off. Find the minimum number of fountains that must be switched on to cover the road.

Example

n = 3

locations[] = {0, 2, 13}then

For position 1: locations[1] = 0, max((1 – 0),

1) to mini (1+0), 3) gives range = 1 to 1

For position 2: locations[2] = 2, max((2-2),

1) to min( (2+2), 3) gives range = 1 to 3

For position 3: locations[3] = 1, max( (3-1),

1) to min( (3+1), 3) gives range = 2 to 3

For the entire length of this road to be covered, only the light at position 2 needs to be activated.

Function Description

Returns

int: the minimum number of street lights that must be activated

Constraints

  • 1<_n<_ 10^5
  •  O<_locations[i] <_ mini (n,100) (where 1 <_1<_

10^5)

► Input Format For Custom Testing

Sample Case 0

Sample Input For Custom Testing

3 ->locations[] size n = 3

1 ->locations[] [1, 1, 1]

1 ->Sample Output

Sample Output

1

Question 4: Parallel Columbus

Problem Statement –  Nobel Prize-winning Austrian-Irish physicist Erwin Schrödinger developed a machine and brought as many Christopher Columbus from as many parallel universes as he could. Actually, he was quite amused by the fact that Columbus tried to find India and got America. He planned to dig it further.

Though totally for research purposes, he made a grid of size n X m, and planted some people of America in a position (x,y) [in 1 based indexing of the grid], and then planted you with some of your friends in the (n,m) position of the grid. Now he gathered all the Columbus in 1,1 positions and started a race.

Given the values for n, m, x, y, you have to tell how many different Columbus(s) together will explore you as India for the first time.

Remember, the Columbus who will reach to the people of America, will be thinking that as India and hence wont come further.

Function Description:

Complete the markgame function in the editor below. It has the following parameter(s):

Parameters:

NameTypeDescription
nInteger

The number of rows in the grid.

mIntegerThe number of columns in the grid.
xIntegerThe American cell’s Row.
yIntegerThe American cell’s Column.

Constraints:

  • 1 <= n <= 10^2
  • 1 <= m <= 10^2
  • 1 <= x <= n
  • 1 <= y <= m

Input Format:

  • The first line contains an integer, n, denoting the number of rows in the grid.
  • The next line contains an integer m, denoting the number of columns in the grid.
  • The next line contains an integer, x, denoting the American cell’s row.
  • The next line contains an integer, y, denoting the American cell’s column.

Sample Cases

Sample Input 1

2

2

2

1

Sample Output 1

1

Explanation

The only way possible is (1,1) ->(2,1) -> (2,2), so the answer is 1. 

Question 5: Find the homeless 

Problem Statement -:  There are N Homeless people in the community and N houses in the community. It will be given in the array (people), the height of the person, and in the array house capacity of the house is given.

The government decided to give homes to people on the basis of the following conditions:

  • Priority is given to the people from left to right of the array
  • Each person is allotted to a house if and only if the capacity of the house is greater than or equal to the person’s height
  • Nearby empty Houses are allotted to the person( starting from the extreme left)

You need to find the number of homeless people who have not been allotted any home if the government follows the above conditions. So that government will have an idea of how many people they need to allot homes for next time.

Constraints:

  • 1 <= N <= 10^3
  • 1 <= people[i] <= 10^5
  • 1 <= house[i] <= 10^5

Input Format for Custom Testing:

  • The first line contains an integer, N, denoting the number of  people and number of houses.
  • Each line i of the N subsequent lines (where 0 <= i <= N) contains an integer describing peoplei.
  • Each line i of the N subsequent lines (where 0 <= i <= N) contains an integer describing housei.

Sample Test Cases

  • Sample Input 1
    3  
    4
    2
    7
    3
    5
    10
  • Sample Output 1
    0
  • Explanation
    people=[4,2,7]
    house=[3,5,10]
    People[0] has more priority , from left to right order in houses 5 is the nearest one which fits for people[0]
    people[1]=2 will fit in 3 which is nearer from left
    people[2]=7 will fit in remaining house of capacity of 10
    So no homeless people left so return 0 
  • Sample Input 2
    3
    3
    8
    5
    1
    9
    4
  • Sample Output 2
    2
  • Explanation
    people=[3,8,5]
    house=[1,9,4]
    people[0]=3 can fit in 9 which is nearest from left in array house
    people[1]=8  cannot fit in any home which is left (i.e, 1 and 4)
    people[2]=5 cannot fit in any home which is left (i.e, 1 and 4)
    So return 2,which is number of homeless people

FAQs on Tech Mahindra Super Coder

Question 1: Who are eligible for Tech Mahindra Super Coder Contest?

Candidates who have passed all the rounds required for Assistant Engineer Job Profile are eligible for this Super Coder Contest. They will get an E-mail invitation from HackerEarth to participate in this round.

Question 2: What are some tips for preparing for a Super Coder technical interview?

One should prepare for Advance Level Data Structures & Algorithms in the chosen language. And should have a clear understanding of Core Subjects of Computer Science like Operating Systems, RDBMS / DBMS, etc.

Question 3: What if the applicants didn't clear the Super Coder Contest?

If the applicants didn’t get passed in Super Coder Contest, they will be offered with the Job profile of Assistant Engineer with a package of ₹ 4 L.P.A.

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others

Checkout list of all the video courses in PrepInsta Prime Subscription

Checkout list of all the video courses in PrepInsta Prime Subscription

2 comments on “Tech Mahindra Super Coder Questions and Answers”


  • deepti

    if a candidate doesn’t pass a particular round in tech mahindra would they be still considered for the hiring process