# Mitsogo Coding Questions and Answers 2023

## Sample Mitsogo Coding Questions with Solutions 2023

Sample Mitsogo Coding Questions and Answers page will help you to get sample Coding Questions asked in the Online Assessment and Technical Interviews of Mitsogo.

Go through this page to get all Sample Mitsogo Coding Questions to preparing for Online Technical Assessment and Technical Interviews of Mitsogo. Apart from that you will get FAQ’s related to Mitsogo Recruitment Process.

### Question 1: Maximum Toys

In a toy shop there are a number of toys presented with several various – priced toys in a specific order. You have a limited budget and would like to select the greatest number of consecutive toys that fit within the budget. Given prices of the toys and your budget, what is the maximum number of toys that can be purchased for your child?

Example:

prices=[1,4,5,3,2,1,6]

money=6

All sub arrays that sum to less than or equal to 6 .

length 1:  [1] [4] [5] [3] [2] [1] [6]

length 2:  [1,4] [3,2] [2,1]

length 3: [3,2,1]

The longest of these or the maximum number of toys that can be purchased is 3.

Function description

Complete the function getMaxToys in the editor below

getMaxToys has the following parameters:

int prices[n] : the prices of the various toys

int money: the amount of money you can spend on toys

Returns

Int the maximum number of toys you can purchase

Constraints

1<=n<=10^5
1<=price[i]<=100
1<=money<=10^6

Sample case

Sample input 0

7->n=7
1-> price[]=[1,4,5,3,2,1,6]
4
5
3
2
1
6
6 ->money

Sample Output
1

### Related Banners

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

### Question 2: Stepping Numbers

Problem Description :

Stepping Numbers are numbers in which the adjacent digits differ by 1. For example, 123, 545, and 98 are stepping numbers, while 321, 444, and 75 are not. The task is to find all stepping numbers in a given range [n, m].

• For example
• Range: [100, 500]
• Stepping Numbers: 101, 121, 123, 210, 212, 232, 234, 321, 323, 343, 345
• Explanation: The stepping numbers between 100 and 500 are 101, 121, 123, 210, 212, 232, 234, 321, 323, 343, and 345. These numbers have adjacent digits that differ by 1.

Write code to find out all the stepping numbers in the given range.

Input Format: First line contains two numbers N,M

Output Format: Print all the stepping numbers present in the range.

Constraints: 0 <= N < M <= 1,000,000,000

### Question 3: Amusement park

Problem Statement – Akshay 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.

The cost of tickets can be removed by removing the digits from the price given. They will give some k turns to remove the digits from the price of the ticket. Your task is to help Akshay in coding a program that can help him to reduce the cost of a ticket by removing the digits from its price and getting the maximum possible discount.

Note – You cannot make the cost of a ticket zero. For eg -: If the cost of a ticket is 100, and you have 2 turns to reduce the price, the final price will be 1 and not zero.

Constraints:

• 1 <= number of tickets <= 10^5
• 1 <= K < Number of digits in Price of ticket

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
2
• Sample Output 1
0

### Question 4: Airport Authority

Problem Statement -:

In an airport, the Airport authority decides to charge a 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:

 Name Type Description N Integer number of luggage T Integer weight of each luggage weights[ ] Integer array threshold 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 luggage.
• Each line i of the N subsequent lines (where 0 <= i <n) contains an integer describing the 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.

### Question 5: Majority Element

The majority element in an array is defined as the element that appears more than ⌊n/2⌋ times, where n is the length of the array.
In other words, it is the element that occurs most frequently and makes up more than half of the array.

Given an array of integers, the task is to find the majority element and return it. If there is no majority element, If there is no majority element, the algorithm should indicate that.

Examples:

Example 1:
Input: [3, 3, 4, 2, 4, 4, 2, 4, 4]
Output: 4
Explanation:
In the given array, the number 4 appears 5 times, which is more than half of the array size (9/2 = 4.5). Therefore, 4 is the majority element.

Example 2:
Input: [1, 2, 3, 4, 4, 4, 4]
Output: 4
Explanation:
In this case, the number 4 appears 4 times, which is more than half of the array size (7/2 = 3.5). Thus, 4 is the majority element.

Example 3:
Input: [1, 2, 3, 4, 5]
Output: -1
Explanation:
There is no majority element in this array since no number appears more than half of the array size (5/2 = 2.5).

Example 4:
Input: [2, 2, 2, 3, 3, 4, 4, 4, 4]
Output: -1
Explanation:
In this case, although the number 4 appears 4 times, it does not occur more than half of the array size (9/2 = 4.5).
Hence, there is no majority element.

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 7: Loki’s Mind Stone

Problem Statement  :

Loki, the God of mischief can brainwash any living person by touching him/her with his Mind stone, and has decided to break the avengers (a warrior group) to face into each other, so that they can turn against each other and make Loki’s evil plans easier. Now all the avengers have some amount of strength that is denoted in integers. Loki wants to brainwash the least amount of people possible, because he is lazy. But he wants his team of avengers to win the battle. What is the number of avengers Loki will get brainwashed.

Input Format:
First line contains an integer n, denoting the number of total avengers
the next line contains n space separated integers denoting the power of each avenger.

Output Format:
One line denoting the total number of avengers brainwashed by Loki’s Mind stone.

Constraints:
2<=n<=10^6

Test case:
Sample Input:
6
9 3 1 2 4 2

Sample Output:
2

Output Specifications:
Loki can brainwash the avengers with power 9 and 3, or with 9 and 2, or with 9,4, and the rest will be losing cause cumulative power of rest avengers is less than the brainwashed total power by Loki.

### Question 8: Hostel warden

Problem Statement :

There is a hostel warden in some XYZ hostel. He is very strict with students. He has some set of rules to allow students to let them out.
Students are in random order but warden don’t allow them in that way.
Rule 1- whose initial is a prime value should go out before whose initial is a composite value.
Rule 2- if two students have prime value , a student with less value goes out first
Rule 3- if two students have composite value , a student with greater value goes out first
NOTE:- consider the ASCII value of the initial to find it is prime or composite.

Input format:
The first line of input contains the number of students N
The second line of input contains random order of the students S.
(students at index zero goes out first and students at index N-1 goes last)

Constraints
1<=number of students <=105
33<=ASCII Of Characters<=126

Output Format
The single line of output should contain the required modified order of students to go out.

Sample Input
13
Kkunjkhahorin

Sample Output
akkuronnjihhK

Explanation
For primes: a<k
For Composite: K<h<i<j<n<o<r<u

### Question 9: HR issues

Problem statement -:

Shovon is an HR in a renowned company and he is assigning people to work. Now he is assigning people work in a fashion where if he assigns somework a work of cost 2, the next person will be strictly getting a job with cost equal or more than 2. Given that Shovon’s company has infinite work and a number of employees, how many distributions can be possible. The cost of jobs can go 0 to 9.

Function Description:

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

Parameters:

 Name Type Description N Integer The number of depts. arr[ ] Integer array The number of  employees in each dept..

Return: The function must return an INTEGER denoting the sum of answers for all distinct distributions.

Constraints:

• 1 <= n <= 100
• 1 <= arr[i] <= 200

Sample Cases:

• Sample Input 1
2
4
1
• Sample Output 1
725
• Description
The ans if m = 1 is 10, which is all numbers from 0 to 9
The ans for m = 2 is 55
The answer for m = 3 is 220
The answer for m = 4 is 715
So fun(4) + fun(1) = 725

### Question 10 :A Good Prime Number

Problem Statement  :

A prime number is a number which is divisible by one and itself. Also a number is called a good  prime number if the sum of its digits is a prime number. For example a number 23 is a good prime number because the sum of 2 and 3 ( 2+3=5) is 5 which is a prime number. You are given an integer K. Your task is to find the kth good prime number that is greater than a provided number N.

For example , 232 is a good prime number since the sum of all digits is 7 which is a prime number whereas 235 is not a good prime number.

Input format :

• The first line contains an integer N.
• The next line contains an integer K.

Output format :

A single integer which is a Kth good prime number that is greater than a provided number N.

Constraints :

• 1<=N<=10^5
• 1<=K<<=10^5

Sample Input 1:

4  4

Sample Output 1:

12

Explanation :

Good prime numbers starting from 4 are 5,7,11(1+1=2 which is prime number),12(1+2=3 which is prime number),14(1+4=5 which is a prime number) and so on. Because the sum of digits of an individual number is a prime number And 4 th good prime number is 12 in this series.Hence the output is 12.

Sample Input 2:

17  5

Sample Output 2:

29

Explanation :

Good prime numbers starting from 17 are 20,21,23,25,29…and the 5th prime number is 29.Hence the output is 29.

## FAQs on BNY Mellon Coding Questions

##### Question 1: How many rounds are there in Mitsogo?

Mitsogo usually conducts 1 Technical Interview followed by HR interview to hire freshers.

##### Question 2: How to prepare for Mitsogo interview?

For Mitsogo Technical Interview the applicants must have good knowledge of Computer Science Fundamentals along with Data Structures and Algorithms based Coding.

##### Question 3: What is the salary of Mitsogo?

For the entry level role of Software Development Engineer in Mitsogo, ₹ 4.5 – 6 LPA is offered to the freshers.

## 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