Round 1: Online Assessment
Questions:
-
Given an array, find sum such that if
If a[i] < a[i+1] then add 1
If a[i] > a[i+1] then add 2 -
Given String1 = panel and set of strings namely codes, for each index1 i in code in codes, check if the string to the right of index1 matches the string at index2 of panel formed by taking digits to the left of index1 in code (Implementation heavy string matching) (Took me the most time: 17 mins)
-
Given an array of 0’s and 1’s only and below 2 operations as m queries, return resultant array after performing all operations
L: switch 0 at smallest index to 1 if any
C{index}: change value at index to 0
Scored 600/600. Verdict: Passed.
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.
Round 2: Business Phone Screen
Questions: Given a sorted array with positive and negative values, sort them based on the square of its values. Also, print the squared values array.
- Expected O(N) working code and interviewer made me run the code with sample tests and compare output
- Sample: [-7, -2, -1, -1, 1, 2, 2, 2, 3, 5] => [-1, -1, 1, -2, 2, 2, 2, 3, 5, -7]
Follow Up: Now, given the same array, how would you modify your code to find the kth smallest square element in the array. Expected O(LogN)
The problem can be reduced to finding the kth smallest element in union of two sorted arrays similar to median of two sorted arrays
Was not able to provide an O(LogN) working solution for the 2nd question. Interviewer gave no hints.
Verdict: Rejected. Received same day outcome
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.