You are on page 1of 2

1.

There are only 1, 3, and 4 rupee coins available, and the cashier needs to offer the customer
N rupees. He wants to use the fewest possible coins while still giving the appropriate amount.
Input - N (integer) Amount of money to be given
Output - Minimum number of coins required
Example - Input - 11
Output - 3 (4 + 4 + 3)
Test cases - a. 7 Ans= 2 (4 + 3)
b. 49 Ans= 13(4*12 + 1)
c. 6 Ans= 2 (3 + 3)
d. 10 Ans= 3 (4 + 3 + 3)

2. In the nation xxx, a new business has been established that pays employees based on the
number of hours they put in. Given a person's start and finish times, your objective is to
determine how many hours they worked.
Input - The first line contains the start time
The second line contains the finish time
Note - Both lines contain two space-separated values - A/P Time (A means am and P
means pm)
Output - Number of hours the person worked
Example - Input - P 3
P5
Output - 2
Test cases - a. A 8 A 12 Ans= 4
b. P 1 P 7 Ans= 6
c. A 6 P 10 Ans= 16
d. A 8 P 4 Ans= 8

3. When given a set of numbers, a software developer is able to use the array's elements to
create the largest pairwise product feasible. Yet, he is unable to identify the second-largest
pairwise product. Identify it for him.
Input - N (Number of elements in the array) n>2
n1, n2, n3, .... (N values of the array)
Output - Second maximum pairwise product possible
Example - Input - 3
456
Output - 24 (30 is maximum)
Test cases - a. 5 1 4 6 2 3 Ans= 18
b. 4 3 3 3 3 Ans= 9
c. 3 6 5 4 Ans= 24
d. 4 9 8 8 9 Ans= 72

4. In the town, a brand-new lottery firm has recently been launched. Customers are instructed to
choose a number between 0 and 9 by the store owner. The person who selected the number
with the least repetition at the end of the day wins. Your goal is to find the number with the least
repetitions.
Input - N (Number of customers)
n1 n2 n3....... (Numbers chosen by customers)
Output - Number with the least repetition. In case there are multiple numbers with the least
repetition, you can print any one of them.
Example - Input - 10
0352920163
Output - 1 / 9 / 5 / 6
Test cases - a. 5 0 2 7 2 0 Ans= 7
b. 3 5 4 4 Ans= 5
c. 7 0 1 8 7 4 0 1 Ans= 7 / 8 / 4
d. 1 9 Ans= 9

5. When someone sends the same email repeatedly, the CEO's personal assistant filters the
emails to ensure that each unique email is only sent once. If this happens, the duplicate emails
are deleted. Create a program that will look at the mail id and determine how many emails need
to be erased. Note that mail id is the same if the same mail is sent again.
(If you are using Python to programme the code, you cannot use the set() function)
Input - N (Number of mails)
r1 r2 r3.... (N mail ids)
Output - No. of emails to be deleted
Example - Input - 6
133433
Output - 3
Test cases - a. 10 6 4 3 5 7 4 6 5 2 4 Ans= 4
b. 5 3 5 1 3 2 Ans= 1
c. 6 5 2 4 5 2 2 Ans= 3
d. 2 1 3 Ans= 0

6. There are n spaceships standing in a line, each of which contains some value in it. A thief is
going to steal the maximal value in these spaceships, but he cannot steal in two adjacent
spaceships because the Captain of a stolen spaceship will tell his two neighbors on the left and
right side. What is the maximal stolen value?
Input - N (Number of spaceships)
n1 n2 n3.... (Values stored in each spaceship)
Output - Maximum amount of value that can be stolen
Example - Input - 4
6127
Output - 13 (6 + 7)
Test cases - a. 9 6 1 2 9 20 7 3 1 4 Ans= 35
b. 11 6 5 7 3 3 4 7 9 9 2 1 Ans= 33
c. 6 5 9 3 2 6 2 Ans= 15
d. 3 1 3 1 Ans= 3

You might also like