Goldman Sachs Software Developer Hiring Test
Q1 Number Checker
Given an integer array as input, find out the integers which contains the digit 1, 2, 3. The order need not be sequential.
- In case multiple numbers qualifies the condition, the outcome should be ordered based on numeric value in ascending order separated by comma
- In case no number qualifies the condition, return -1.
Input
1456
345671
43218
123
Output 123, 43218
Solution
Q2 Array Burst Problem
Given an input length, string array and burst length (>0), the output should be an array such that the sequentially repeating elements more than or equal to the burst length should be removed. This has to be repeated till the array cannot be shrunk any further.
Sample1
Input
8
a b c c c d e e
3
Output: a b d e e
Sample2
Input
15
a b c d e e e e d d c b f g f
3
Output: a b c c b f g f
Solution
Q3 Non repeating digit in product
Given a number x, and a range of y to z, find the count of all the numbers n in that range such that the product of the number n and x does not contain any digit from the number n.
Example
x=2, y=10, x=15 then
2*10=20 Invaid
2*11=22 Valid
2*12=24 Invalid
2*13=26 Valid
2*14=28 Valid
2*15=30 Valid
Output: 4
Solution
No comments :
Post a Comment