Zoho Round 2 Questions: Sample Input 1
Zoho Round 2 Questions: Sample Input 1
Zoho Round 2 Questions: Sample Input 1
1. Given an array of integers perform the operation, the output array should contain maximum value of next
array indices (I.e. Replace the each array element by next greater element in the array). If there is no element next to
a current element, replace the element value with -1. The given array should also contain negative value as well as
duplicate values. Refer sample input and output:
SAMPLE INPUT 1:
1 2 3 4 5
SAMPLE OUTPUT 1:
5 5 5 5 -1
SAMPLE INPUT 2:
16 8 17 16 9 10
SAMPLE OUTPUT 2:
17 17 16 10 10 -1
SAMPLE INPUT:
n = 3, k = 2
123
456
789
SAMPLE OUTPUT:
12 16
24 28
3. Given an M X M Square matrix, Traverse the matrix in Mirrored Z form and the print the values.
SAMPLE INPUT:
123
456
789
SAMPLE OUTPUT:
MIRRORED Z TRAVERSEL IS : 3 2 1 5 9 8 7
4. Consider an ATM should contain possible denominations notes, you need to perform the operation by
satisfying the following conditions.
The available denominations are Rs.100, Rs.200, Rs.500, Rs.2000
• Customer should enter the withdrawal amount in multiples of 100
• The withdrawal denomination should contain the possible higher denominations and all lower denominations
• Count of lesser denomination notes should be lesser or equal to the count of its highest denomination
Input Format:
First line corresponds to integer n.
Output Format:
Refer to the sample input and output for formatting specifications.
Sample Input 1:
Rotate the wheel through 180 degrees
Sample Output 1:
etatoR eht leehw hguorht 081 seerged
Sample Input 2:
ABCD FEGHI
Sample Output 2
DCBA IHGEF
Sample Input 1:
"Hello from here"
"reHello from he"
Sample Output 1:
Yes
Sample Input 2:
"Hello from here"
"erHello from he"
Sample Output 2:
No
3. Program to convert a given number to words is discussed here. For example, if 1234 is given as input, the
output should be “one thousand two hundred and thirty four”.
Input:
Input consist of an one integer.
Output:
Refer to the sample input and output for formatting specifications.
Sample Input:
9923
Sample Output:
nine thousand nine hundred and twenty three
Example:
Input : {12:34:55,1:12:13,8:12:15}
Output :
4:22:40
Explanation :
12:34:55 - 8:12:15 = 4:22:40
12:34:55 - 1:12:13 = 11:22:42
8:12:15 - 1:12:13 = 7:0:02
smallest is 4:22:40
Input Format:
The first line of the input consists of an integer, N that corresponds to the number of duration's in the input array.
The next N lines of the input corresponds to the duration's in a given array. Assume that the duration are given in
the format: hours:minutes:seconds
Output Format:
Output is to display the shortest time duration (in hours:minutes:seconds) of all values in a given array Refer to the
sample input and output for formatting specifications.
Sample Input 1:
3
12:34:55
1:12-13
8:12:15
Sample Output 1:
4:22:40
Write a program to find a fragment that occurs in all strings, where a fragment is 3 consecutive words.
Note: If you are writing this program in JAVA, don't use built-in functions like split(), indexOf(), replace(),
substring(). etc present in String Class. Do not hard code the output.
Example:
Given three strings like:
S1 = "Every morning I want to do exercise regularly"
S2 = "Every morning I want to do meditation without fail"
S3 = "It is important that I want to be happy always"
Then the:
Common fragment = "I want to"
Explanation:
"I want to" is the common fragment (3 continuous words) found in all three sentences.
Input Format:
First line of the input is an integer n, which corresponds to the number of strings.
Second line of the Input consists of n strings line by line
Output Format:
Display the common fragment.
Refer to the sample input and output for formatting specifications.
Sample Input:
3
Every morning I want to do exercise regularly
Every morning I want to do meditation without fail
It is important that I want to be happy always
Sample Output:
I want to