LTIMindtree Coding Questions and Answers

LTIMindTree Coding Questions and Answers

LTIMindTree Coding Questions are mix of all basic programming concepts, Dynamic Programming, data structures and algorithm etc.

In exam, you will get 2 different questions based on the above concepts such as array, string, normal mathematics.

In LTIMindtree, coding test section is described as:-

  • Total Questions: 2-3 Ques
  • Total Time: 35 mins
LTIMindTree Coding Round

LTIMindTree Coding Questions and Answers

LTIMindTree Coding Ques are based on the following languages.

  • C
  • C++
  • JAVA
  • Python

LTIMindTree Coding Test 2025

Important instructions for LTIMindTree Coding Test 2025:-

  • The program should be executed at least once.
  • The program can be executed any number of times.
  • The execution yielding highest score is taken into consideration for the final scoring.
  • Use ‘Run custom Input‘ and/or ‘Run code‘ to debug the code by getting the output.
  • To submit the code you need to turn off the debug mode i.e. ‘Custom Input ‘.
  • You are allowed to code in
    • C
    • C++
    • Java
    • Python
  • Though language are version independent if it is not explicitly specified.
TopicsNo. of Questions
Number of Questions2-3
Time Limit35 mins
DifficultyHigh
ImportanceHigh

 

MindTree Practice Coding Questions

Here, you can practice LTIMindTree miscellaneous coding questions based on implementation, DS/Algo and Advanced Algo section that comes in exam. These are some of the common ques asked in LTIMindTree coding test.

  1. Pattern based Programs.
  2. Remove vowel from the given String.
  3. Eliminate repeated array from the given string.
  4. Counting the number of even and odd elements in an array.
  5. Replace a sub-string in a string.
  6. Loop Based Programs.
  7. Find Prime Numbers up to n.
  8.  Reverse a String.

Question: Self Sufficient

Problem Statement – 

Abhijeet is one of those students who tries to get his own money by part time jobs in various places to fill up the expenses for buying books. He is not placed in one place, so what he does, he tries to allocate how much the book he needs will cost, and then work to earn that much money only. He works and then buys the book respectively. Sometimes he gets more money than he needs so the money is saved for the next book. Sometimes he doesn’t. In that time, if he has stored money from previous books, he can afford it, otherwise he needs money from his parents.

Now His parents go to work and he can’t contact them amid a day. You are his friend, and you have to find how much money minimum he can borrow from his parents so that he can buy all the books.

He can Buy the book in any order.

Function Description:

Complete the function with the following parameters:

NameTypeDescription
NIntegerHow many Books he has to buy that day.
EarnArray[ ]Integer arrayArray of his earnings for the ith book
CostArray[ ]Integer arrayArray of the actual cost of the ith book.

Constraints:

  • 1 <= N <= 10^3
  • 1 <= EarnArray[i] <= 10^3
  • 1 <=  CostArray[i] <= 10^3

Input Format:

  • First line contains N.
  • Second N lines contain The ith earning for the ith book.
  • After that N lines contain The cost of the ith book.

Output Format: The minimum money he needs to cover the total expense.

Sample Input 1:

3

[3 4 2]

[5 3 4]

Sample Output 1:

3

Explanation:

At first he buys the 2nd book, which costs 3 rupees, so he saves 1 rupee. Then he buys the 1st book, that takes 2 rupees more. So he spends his stored 1 rupee and hence he needs 1 rupee more. Then he buys the last book.

Question: 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 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: Amusement park

Problem Statement-

Aashay loves to go to WONDERLA , an amusement park. They are offering students who can code well with some discount. Our task is to reduce the cost of the ticket as low as possible.

They will give some k turns to remove the cost of one ticket where the cost of tickets are combined and given as string.Help Aashay in coding as he is not good in programming and get a 50%  discount for your ticket.

Constraints:

  • 1 <= number of tickets <= 10^5
  • 1 <= K <= number of tickets

Input Format for Custom Testing:

  • The first line contains a string,Tickets, denoting the given cost of each ticket.
  • The next line contains an integer, K, denoting the number of tickets that is to be removed.

Sample Cases:

  • Sample Input 1
    203
    3
  • Sample Output 1
    0

Question: Airport authority

Problem Statement -:

In an airport , the Airport  authority decides to charge some minimum amount to the passengers who are carrying luggage with them. They set a threshold weight value, say T, if the luggage exceeds the weight threshold you should pay double the base amount. If it is less than or equal to threshold then you have to pay $1.  

Function Description:

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

Parameters:

NameTypeDescription
NIntegernumber of luggage
TIntegerweight of each luggage
weights[ ]Integer arraythreshold weight

Returns: The function must return an INTEGER denoting the required amount to be paid.

Constraints:

  • 1 <= N <= 10^5
  • 1 <= weights[i] <= 10^5
  • 1 <= T <= 10^5

Input Format for Custom Testing:

  • The first line contains an integer, N, denoting the number of luggages. 
  • Each line i of the N subsequent lines (where 0 <= i <n) contains an integer describing weight of ith luggage. 
  • The next line contains an integer, T, denoting the threshold weight of the boundary wall.

Sample Cases:

  • Sample Input 1
    4
    1
    2
    3
    4
    3
  • Sample Output 1
    5
  • Explanation:
    Here all weights are less than threshold weight except the luggage with weight 4 (at index 3) so all pays base fare and it pays double fare.