Round 1 : Online round on hackerrank
- 4 Questions (50+100+100+150)
- 2 hours
Question 1: [Easy – 50]
There are books in a shelf, Either type of X or Y, Your mom wants to make sure before your birthday party, shelf is arranged. All the X type of books should be on left, and all the books of type Y should be on right. There is a time cost associated with each swap, output if it is possible to arrange them before the party starts.
Question 2: [Medium – 100]
You have been given A and B in range. Find the product of all numbers in the range.
1<=A<=100,000 and A<=B<=100,000
You need to return the answer as a string in the form of, “C x 10^D”
If C has more than 10 digits, then output C as 12345…12345 x 10^D
49 x 10^0
355687…28096 x 10^3
Question 3: [Medium – 100]
You have been given an array, which represents height of light towers. For every tower, it’s range is (A*B % 1000000007) where :
A = (Buildings visible on left side + Buildings visible on right side)
B = position of light tower in the array (1…N) [1 based indexing]
You have to return the position of lighthouse which has maximum range. If two have same range, return the one with minimum B (leftmost).
Question 4: [Medium – 150]
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course. In case you are prepared, test your skills using TCS, Wipro, Amazon and Microsoft Test Serieses.