Add office photos
Engaged Employer

MathWorks

3.9
based on 132 Reviews
Video summary
Filter interviews by

JTPL Interview Questions and Answers

Updated 13 Apr 2024

Q1. Car Pooling Capacity Problem

You are a cab driver with a car that initially has 'C' empty seats. The car moves in a straight line towards the forward direction only. Your job is to determine if it is possible t...read more

Ans.

Determine if it is possible to handle all passenger trips within the car capacity without exceeding it at any point.

  • Iterate through each trip and keep track of the total number of passengers in the car at each point.

  • Check if the total number of passengers exceeds the car capacity at any point, return 'False'. Otherwise, return 'True'.

Add your answer

Q2. Convert BST to Greater Sum Tree

Given a Binary Search Tree (BST) of integers, your task is to convert it into a greater sum tree. In the greater sum tree, each node's value should be replaced with the sum of al...read more

Ans.

Convert a Binary Search Tree into a Greater Sum Tree by replacing each node's value with the sum of all nodes' values greater than the current node's value.

  • Traverse the BST in reverse inorder (right-root-left) to visit nodes in descending order.

  • Keep track of the running sum of visited nodes and update each node's value with this sum.

  • Recursively apply the above steps to all nodes in the BST.

  • Example: For the input BST [4, 1, 6, 0, 2, 5, 7], the output Greater Sum Tree will be [...read more

Add your answer

Q3. Distance To Nearest 1 in a Binary Matrix Problem

Given a binary matrix MAT containing only 0s and 1s of size N x M, find the distance of the nearest cell containing 1 for each cell in the matrix.

The distance i...read more

Ans.

Given a binary matrix, find the distance of the nearest cell containing 1 for each cell in the matrix.

  • Iterate through the matrix and for each cell, find the nearest cell containing 1 using BFS or DFS.

  • Calculate the distance using the formula |i1 – i2| + |j1 – j2|.

  • Update the matrix with the distances to the nearest cell with 1.

  • Handle edge cases like cells already containing 1 or cells with no 1s nearby.

  • Ensure movements are only allowed in four directions: Up, Down, Left, and Ri...read more

Add your answer

Q4. K-th Ugly Ninja Problem Statement

Ninja is looking to hire 'ugly ninjas' whose numbers have all prime factors from a given list. Your task is to help him find the K-th ugly ninja.

You will be given an array PRI...read more

Ans.

Find the K-th ugly ninja number using prime factors from a given list.

  • Generate ugly numbers using prime factors from PRIME_ARR

  • Keep track of the K-th ugly number

  • Return the K-th ugly number

Add your answer
Discover JTPL interview dos and don'ts from real experiences

Q5. Optimal Strategy for a Coin Game

You and your friend Ninjax are engaged in a strategic game involving coins. Ninjax arranges 'N' coins in a linear sequence.

The rules of the game are as follows:

1. Each coin ha...read more
Ans.

Determine the maximum amount you can win in a coin game by selecting coins strategically.

  • Start by understanding the rules of the game and the goal of maximizing winnings.

  • Consider the fact that you can choose either the first or last coin in each turn.

  • Think about how to ensure you make the best choice at each turn to guarantee the maximum win.

  • Examples: For the input 4 9 5 21 7, selecting coins in the order of 9 and 21 results in a maximum win of 30.

Add your answer

Q6. Count Pairs Divisible by K

You are given an array ARR and a positive integer K. Your task is to count the total number of pairs within the array whose sum is divisible by K.

Example:

Input:
ARR = [4, 3, 5, 1, 4...read more
Ans.

Count pairs in an array whose sum is divisible by a given integer K.

  • Iterate through the array and calculate the remainder of each element when divided by K.

  • Store the remainders in a hashmap along with their frequencies.

  • For each remainder R, check if K - R is present in the hashmap and add the product of their frequencies to the count.

  • Return the total count of pairs whose sum is divisible by K.

Add your answer

Q7. Interest in Matlab

Ans.

I have a strong interest in Matlab due to its powerful data analysis and visualization capabilities.

  • I have experience using Matlab for data analysis and visualization in my academic projects.

  • I find Matlab's syntax to be intuitive and easy to learn.

  • I appreciate Matlab's extensive library of functions for various mathematical and engineering tasks.

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at JTPL

based on 1 interviews
2 Interview rounds
Coding Test Round
HR Round
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Software Developer Intern Interview Questions from Similar Companies

4.4
 • 30 Interview Questions
3.8
 • 25 Interview Questions
4.2
 • 20 Interview Questions
3.4
 • 12 Interview Questions
3.7
 • 12 Interview Questions
2.0
 • 11 Interview Questions
View all
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
75 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter