It was a coding test on HackerRank platform. Two simple algorithmic questions were asked there which required basic knowledge on STL (for C++) and Maths. Test duration was 45 minutes.
Question 1: A string representing HTML tags are given. Find if corresponding HTML tags are equal or not. Return 1 for true and 0 for false cases.
Example – 1 <HTML><HEAD></HTML></HEAD> return true. (Yea, order doesn’t matter)
Example -2 <HTML><HEAD></HEAD></HEAD> return false.
Question 2: Given a number N, find the k’th character in m’th shortest permutation of sequence 1, 2, 3….N.
Example: N=3, k=2, m=2.
1 2 3
1 3 2
2 1 3
2 3 1
3 1 2
3 2 1
These will be the permutations, now the 2nd character of 2nd permutation will be 3.
After coding test, 22 people were shortlisted for Interviews. There were two Interviews for me. First Interview was a telephonic one, which lasted for about 2.5 hours.
Questions included in Interview-1:
- Given a stream of numbers, find the median of numbers.
- Couple of DP questions on stock selling, given the prices of them on each day.
- Given a 2-D grid of characters, and a list of words, find how many words can be found inside the grid. We can search in all 8-directions.
- A question on greedy approach, in which interviewer tried to confuse me that the solution has to be by Dynamic Programming, but it wasn’t.
- Java-OOP related questions on Constructors.
- Questions on implementing Generic Array, and was also asked about basic differences in JAVA-C++ coding.
Questions included in Interview-2:
- Find the majority element, which appears more than n/2 times in O(1) space and O(n) time complexity.
- A DP question on how to partition n boxes into k partitions so as to get maximum profit. Condition for profit, suppose the sum of price of boxes in partition is 25, then we can show it as 30 and hence, earn a profit of 5. Similarly, if it’s 24, we have to show it as 20 and hence, we lose 4.
- SQL query: Find 5th largest salary in a given Salary table.
- Explain Dirty-Read Problem and how the scheduling has to be done to overcome it.
- Explain dangling pointers.
- How is absence of virtual functions overcome in Java.
Round-3 was HR round. Questions were very easy. It included-
- Tell me about yourself.
- What do you know about DE Shaw and Co.?
- What are your expectations from company?
In the last, HR told me about that my performance had been good so far and most probably, I will be selected into it.