Mts1

filter-iconFilter interviews by

20+ Mts1 Interview Questions and Answers for Freshers

Updated 29 Oct 2021

Popular Companies

search-icon

Q1. Expression Equality Checker

Given two strings representing expressions in variables, determine if they are equivalent. Return 'YES' if the expressions are identical and 'NO' if they are different. Each expressi...read more

Ans.

Check if two expressions are equivalent by evaluating them with different variable assignments.

  • Parse the expressions to evaluate them with different variable assignments.

  • Use a stack to keep track of operands and operators while evaluating the expressions.

  • Compare the results of both expressions to determine if they are equivalent.

Q2. Minimum Number of Platforms Problem

Your task is to determine the minimum number of platforms required at a railway station so that no train has to wait.

Explanation:

Given two arrays:

  • AT - representing the ar...read more
Ans.

Determine the minimum number of platforms needed at a railway station so that no train has to wait.

  • Sort the arrival and departure times arrays in ascending order.

  • Initialize two pointers for arrival and departure times, and a variable to keep track of the maximum number of platforms needed.

  • Increment the platform count when a train arrives and decrement when a train departs.

  • Update the maximum platform count as needed.

  • Return the maximum platform count at the end.

Q3. ...read more

Number and Digits Problem Statement

You are provided with a positive integer N. Your task is to identify all numbers such that the sum of the number and its digits equals N.

Example:

Input:
N = 21
Output:
[15]
Ans.

Identify numbers whose sum with digits equals given integer N.

  • Iterate through numbers from 1 to N and check if sum of number and its digits equals N.

  • Use a helper function to calculate sum of digits for a given number.

  • Return -1 if no such number exists for a test case.

Q4. Matrix Element Cube Sum Problem

For a given M x N sized 2D array 'MATRIX', find and return the value of (i * i + j * j) for elements where the sum of the cubes of its digits equals the element itself. Here, 'i'...read more

Ans.

Find and return the value of (i * i + j * j) for elements in a 2D array where the sum of the cubes of its digits equals the element itself.

  • Iterate through the 2D array and check if the sum of the cubes of the digits equals the element itself.

  • Calculate (i * i + j * j) for elements that satisfy the condition.

  • Return the calculated values as output.

  • If no element satisfies the condition, return -1.

Are these interview questions helpful?

Q5. Longest Increasing Subsequence Problem Statement

Given an array of integers with 'N' elements, determine the length of the longest subsequence where each element is greater than the previous element. This subse...read more

Ans.

Find the length of the longest strictly increasing subsequence in an array of integers.

  • Use dynamic programming to solve this problem efficiently.

  • Initialize an array to store the length of the longest increasing subsequence ending at each index.

  • Iterate through the array and update the length of the longest increasing subsequence for each element.

  • Return the maximum value in the array as the result.

Q6. Cycle Detection in a Singly Linked List

Determine if a given singly linked list of integers forms a cycle or not.

A cycle in a linked list occurs when a node's next points back to a previous node in the list. T...read more

Ans.

Detect if a singly linked list forms a cycle by checking if a node's next points back to a previous node.

  • Traverse the linked list using two pointers, one moving one step at a time and the other moving two steps at a time.

  • If the two pointers meet at any point, it indicates the presence of a cycle in the linked list.

  • To optimize, use Floyd's cycle detection algorithm for O(N) time complexity and O(1) space complexity.

Frequently asked in,

Share interview questions and help millions of jobseekers 🌟

man-with-laptop

Q7. Split the String Problem Statement

You are given a string str consisting of N lowercase alphabets. Your task is to determine if it is possible to divide the string into three non-empty substrings such that one ...read more

Ans.

Determine if it is possible to split a string into three non-empty substrings where one is a substring of the other two.

  • Check if any substring of the string is a substring of the other two substrings.

  • Iterate through all possible divisions of the string into three non-empty substrings.

  • Use two pointers to find all possible substrings efficiently.

Q8. Preorder Traversal to BST Problem Statement

Given an array or list PREORDER representing the preorder traversal of a Binary Search Tree (BST) with N nodes, construct the BST which matches the given preorder tra...read more

Ans.

Given a preorder traversal of a BST, construct the BST and print its inorder traversal.

  • Parse the input to get the number of test cases and preorder traversal for each case

  • Construct the BST using the preorder traversal by recursively building the tree

  • Print the inorder traversal of the constructed BST for each test case

Q9. Loot Houses Problem Statement

A thief is planning to steal from several houses along a street. Each house has a certain amount of money stashed. However, the thief cannot loot two adjacent houses. Determine the...read more

Ans.

Determine the maximum amount of money a thief can steal from houses without looting two consecutive houses.

  • Create an array 'dp' to store the maximum money that can be stolen up to the i-th house.

  • Iterate through the houses and update 'dp' based on whether the current house is stolen or not.

  • Return the maximum value in 'dp' as the answer.

Q10. Ninja and Stack of Boxes Problem

Help Ninja to create the tallest stack possible using given 3-D boxes with dimensions Length 'L', Breadth 'B', and Height 'H'. Each box can be rotated to use any side as the bas...read more

Ans.

Implement a function to find the maximum possible height of a stack of boxes given their dimensions.

  • Create all possible rotations of each box to consider all orientations for stacking

  • Sort the boxes based on their base dimensions in non-increasing order

  • Use dynamic programming to find the maximum height of the stack

Q11. Reverse Edges Problem Statement

You are given a directed graph with ‘N’ nodes and ‘M’ edges, along with two specific nodes, ‘A’ and ‘B’. Your task is to find the minimum number of operations required to create ...read more

Ans.

The task is to find the minimum number of operations required to create a valid path from node A to node B by reversing edges in a directed graph.

  • Iterate through the graph to find the shortest path from node A to node B.

  • Use a graph traversal algorithm like BFS or DFS to explore possible paths.

  • Track the number of edge reversals needed to reach node B from node A.

  • Consider edge directions and reverse them as needed to create a valid path.

  • Return the minimum number of edge reversa...read more

Q12. Rearrange The Array Problem Statement

You are given an array/list 'NUM' of integers. Rearrange the elements of 'NUM' such that no two adjacent elements are the same in the rearranged array.

Example:

Input:
NUM[...read more
Ans.

The task is to rearrange an array such that no two adjacent elements are the same.

  • Iterate through the array and check if any adjacent elements are the same.

  • If adjacent elements are the same, swap one of them with a different element.

  • Return 'YES' if a valid rearrangement is possible, 'NO' otherwise.

Q13. Longest Increasing Path in Matrix Problem Statement

Given a 2-D matrix mat with 'N' rows and 'M' columns, where each element at position (i, j) is mat[i][j], determine the length of the longest increasing path ...read more

Ans.

The task is to find the length of the longest increasing path in a matrix starting from a given cell.

  • Create a recursive function to explore all possible paths from the starting cell, keeping track of the length of each path.

  • Use dynamic programming to avoid redundant calculations and optimize the solution.

  • At each cell, check if moving to the right or down is possible and leads to an increasing path.

  • Update the length of the longest increasing path found so far as you explore di...read more

Q14. Query and Matrix Problem Statement

You are given a binary matrix with 'M' rows and 'N' columns, initially consisting of all 0s. You will receive 'Q' queries, which can be of four types:

Query 1: 1 R index
Query ...read more
Ans.

Implement a function to process queries on a binary matrix by flipping elements and counting zeros in rows/columns.

  • Create a binary matrix with all elements initialized to 0.

  • Process queries of type 1 by flipping elements in the specified row/column.

  • Process queries of type 2 by counting the number of zeros in the specified row/column.

  • Return the count of zeros for type 2 queries.

  • Ensure to handle the constraints provided in the problem statement.

Q15. Check if a Number is Binary

Determine if a given string of integers bin represents a valid binary number. Return 'true' if the string represents a valid binary number, otherwise return 'false'. A binary number ...read more

Ans.

Check if a given string represents a valid binary number composed of 0s and 1s.

  • Iterate through each character in the string and check if it is either '0' or '1'.

  • If any character is not '0' or '1', return 'false'.

  • Return 'true' if all characters are '0' or '1'.

Q16. Lexicographic Permutation Rank Problem Statement

Given a distinct string, determine the lexicographic permutation rank of the string.

Example:

Input:
T = 2
S = "abc"
S = "bac"
Output:
1
2
Explanation:

For the firs...read more

Ans.

The problem involves determining the lexicographic permutation rank of a distinct string.

  • Iterate through all permutations of the string and compare with the given string to determine the rank.

  • Use a recursive function to generate all permutations of the string.

  • Keep track of the count of permutations smaller than the given string to determine the rank.

Q17. Convert Binary Tree to Mirror Tree

Convert a given binary tree into its mirror tree, where the left and right children of all non-leaf nodes are interchanged.

Input:

An integer ‘T’ denoting the number of test c...read more
Ans.

Convert a binary tree into its mirror tree by interchanging left and right children of non-leaf nodes.

  • Traverse the tree in a recursive manner and swap the left and right children of each node.

  • Modify the binary tree in place to get the mirror, without creating a new tree.

  • Use a temporary variable to swap the left and right children of each node.

Q18. Can you describe the system design you created for Pastebin and the set of requirements you had to fulfill?
Ans.

Designed a scalable system for Pastebin with various requirements.

  • Implemented a distributed system architecture to handle high traffic and ensure reliability.

  • Used load balancing techniques to evenly distribute incoming requests across multiple servers.

  • Implemented data sharding to partition data across multiple databases for efficient storage and retrieval.

  • Utilized caching mechanisms to improve performance and reduce latency.

  • Implemented access control mechanisms to ensure data...read more

Q19. Reverse a String Problem Statement

Given a string STR containing characters from [a-z], [A-Z], [0-9], and special characters, determine the reverse of the string.

Input:

The input starts with a single integer '...read more
Ans.

Reverse a given string containing characters from [a-z], [A-Z], [0-9], and special characters.

  • Iterate through each character in the string and append them in reverse order to a new string

  • Use built-in functions like reverse() or slice() to reverse the string

  • Handle special characters and numbers along with alphabets

Q20. What will be the result when adding two binary numbers in a 64-bit and a 32-bit operating system?
Ans.

The result of adding two binary numbers in a 64-bit and a 32-bit operating system will differ due to the different number of bits used for calculations.

  • In a 64-bit operating system, the result will be more accurate and can handle larger numbers compared to a 32-bit system.

  • Overflow may occur in a 32-bit system when adding large binary numbers, leading to incorrect results.

  • Example: Adding 1111 (15 in decimal) and 1111 (15 in decimal) in a 32-bit system may result in overflow an...read more

Q21. What are effective paging techniques, and how do you count page faults?
Ans.

Effective paging techniques help reduce page faults, which are counted by tracking the number of times a page is accessed from disk.

  • Implementing LRU (Least Recently Used) algorithm to replace the page that has not been used for the longest time.

  • Using FIFO (First In, First Out) algorithm to replace the oldest page in memory.

  • Utilizing optimal page replacement algorithm to replace the page that will not be used for the longest time in the future.

  • Counting page faults by tracking ...read more

Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

3.6
 • 7.6k Interviews
3.7
 • 852 Interviews
3.9
 • 234 Interviews
4.0
 • 224 Interviews
3.8
 • 120 Interviews
3.8
 • 76 Interviews
View all

Calculate your in-hand salary

Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary

Recently Viewed
SALARIES
HCLTech
DESIGNATION
DESIGNATION
REVIEWS
Genpact
No Reviews
SALARIES
IBM
JOBS
Access Healthcare
No Jobs
SALARIES
TCS
SALARIES
BDO RISE Private Limited
JOBS
Browse jobs
Discover jobs you love
INTERVIEWS
Shaine Lex Advisors
No Interviews
Mts1 Interview Questions
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
65 L+

Reviews

4 L+

Interviews

4 Cr+

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