Open In App

Hike Interview Experience | Off Campus September 2019

Last Updated : 03 Oct, 2019
Like Article

Round 1: Online Coding Round

5 Programming Questions, Duration: 75 minutes

  1. Given two coordinates (a, b) and (c, d), check if (a, b) can be made (c, d). At every step (a, b) can be converted to (a+b, b) or (a, a+b). Since there are two choices to be made at each step, recursion is the approach. Only “Yes” or “No” had to be the output.
  2. Given a 26 length array which indicates whether a character is normal or special(0/1), a string and an integer k, find the longest substring in input string such that their are atmost k special characters in it. Looking for each substring would timeout so use sliding window technique and keep the count of special characters encountered, Whenever the count>k, reduce the window form the beginning.
  3. Given an array of strings, we can move from one string to another by deleting one character. Find the longest chain that can be formed by performing this operation. Since the chain will constitute of strings with difference of length 1, we can sort the strings on the basis of length and then create the chain.
  4. Given a 2D array with 0 and 1, find the largest square with all 1s. DP question.
  5. Given an array, find the minimum number of swaps needed to move all even elements to beginning and odd elements to end of array.

Round 2:

  1. GetMin() function in Stack.
  2. Given two sorted linked lists, merge them. Then he modified the question to given k sorted linked lists, merge them. This can be done by using k-sized min-heap.
  3. Given an array you have sort it based on the relative ordering of another array. Modify custom sort.
  4. Minimum platforms needed in a railway station. I told him O(nlogn) approach. He asked for O(n) approach. I wasn’t able to think of O(n) approach so he asked another question which would help to solve the current question. How to check if two strings are anagrams? This question helped to find the O(n) solution.
  5. Given an array find all the subsets whose sum is divisible by 8. I knew that cumulative sum had to be taken but then I couldn’t think how to use that. So he told me that I can form an equation of numbers divisible by 8. If say sum(i, j) (i<j)is divisible by 8 then, sum(0, j) = 8*sum(i, j) + sum(0, i-1). And the possible remainders are 0-7. So we can store the remainder at each j, and such combination to determine the answer.
  6. How is HashMap implemented in Java? Handling Collisions and how is the hashmap size handled as more and more data comes in. The hashmap size is doubled and existing keys are remapped.

Round 3:

  1. Singleton class and its implementation.
  2. Reader Writer Problem with modifications to give preference to writer if it arrives, since standard implementation starves writers.

Round 4:

  1. LRU Cache implementation.
  2. Then he modified the question. Each key has a Time to expiry field. So those keys had to be removed from the cache. I started with hashmap but he was looking for a different data structure.

Round 5:

Round with VP. Asked me behavioral questions. About my CV, my interests.

Verdict: Selected.

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads