Round 1 (90 Mins) : In total there were 10 questions (6 MCQ and 4 Coding questions). MCQ questions not very tough. Coding questions were :
- There are n-leaves on a straight line numbered form 1 to n. A caterpillar starts from 0 and starts eating the leaves with some condition. There are total of k-caterpillars and their jump numbers are given in an array. A caterpillar with jump number ‘j’ eats the j, 2j, 3j, …. leaves till n. Like this every caterpillar will eat the leaves respective to their jump numbers. Find out the number of leaves uneaten at the end.
- Like this every caterpillar will eat the leaves respective to their jump numbers. Find out the number of leaves uneaten at the end.
- 1 < n < 2 * 10^9 and 2 <= k <= 22
(Bruteforce solved 7/15 test cases for some people and 10/15 for some other).
n = 10, k = 3 Jump numbers : 2 4 5 Answer : 4 Explanation : 2, 4, 5, 6, 8, 10 will be eaten by the caterpillar and only 1, 3, 7, 9 will be left.
- Jamie is walking along a number line that starts at point 0 and ends at point n. She can move either one step to the left or one step to the right of her current location , with the exception that she cannot move left from point 0 or right from point n. In other words, if Jamie is standing at point i,she can move to either i-1 or i+1 as long as her destination exists in the inclusive range [0,n]. She has a string ,s , of movement instruction consisting of the letters 1 and r , where 1 is an instruction to move one step left and r is an instruction to move one step right.
Jamie followed the instructions in s one by one and in order .For Example if s=‘rrlr’, she performs the following sequence of moves :one step right ->one step right ->one step left -> one step right. Jamie wants to move from point x to point y following some subsequence of string s instruction and wonders how many distinct possible subsequence of string s will get her from point x to point y. Recall that a subsequence of a string is obtained by deleting zero or more characters from string.It has four parameters :
- A String , s giving a sequence of eduction using the characters l( i.e. move left one unit ) and r (i.e. move right one unit)
- An integer n, denoting the length of the number line.
- An integer x, denoting jamie’s starting point on the number line.
- An integer y , denoting Jamie’s enidng point on the number line.
- The function must return an integer denoting the total number of distinct subsequence of string s that will lead Jamie from point x to point y as this value cab be quite large .
Sample Input : rrlrlr 6 1 2 Output = 7
- Find out the sum of common prefixes (common character from starting) of a number with itself by removing first i characters. (i = 1, 2, ….., n-1), n -> length of string.
(Bruteforce got accepted for some people).
Input : ababab Output : 6+0+4+0+2+0 = 12 Explanation : ababab and ababab has common prefix (ababab) of length 6. ababab and babab has common prefix () of length 0. ababab and abab has common prefix (abab) of length 4. ababab and bab has common prefix () of length 0. ababab and ab has common prefix (ab) of length 2. ababab and b has common prefix () of length 0.
- Calculate the cumulative sum of the array and keep track of the minimum, if minimum less than one return (min*-1)+1; else return 0.
Round 2 : Did 2.5 coding questions in first round and 4/6 mcq were correct. Shortlisted for Interviews. The only he asked me was to write code for converting sorted array to balanced tree. I took a bit of time and wrote the code. Then he asked me about the complexity of the code I said it write. Didn’t get shortlisted for 2nd round.
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.