D.E. Shaw | Code Pair | QTE | Jan 2022 | Two Sum
Anonymous User
2490

I appeared for the code pair round (which was on Hackerrank), It contained 3 parts - Coding Question, Testing Questions and Resume based questions.

Coding question was simple modification of two sum problem and could be done in O(n) using a hashmap, I wasted so much time figuring out the duplicate case and ultimately was getting wrong answer. It was a nice interview and interviewer was really humble and helpful.

There is a list of songs = [10, 20, 40, 90], find all the pairs of songs with runtime sum is a multiple of 60min (60, 120, 180..). You need to print the number of pairs. 

Logic : (a+b)%60 = 0
        a%60 + b%60 = 0
and then just apply standard two sum approach.

Mistake: Instead of storing the index as int we need to store it as vector and make algorithm accordingly.

Got rejected since I was not having much experience in writing test cases and this was strictly for someone from testing background.

Comments (1)