Round 1
Questions:
-
496 followed by "Find the number of elements in an inclusive range in a sorted list".
I solved the first part easily and the second part as well, but forgot to handle duplicates in the list. Once prompted by the interviewer I solved that easily as well.
-
Given two arrays of departure prices and return prices find the minimum total cost of a trip (return has to be on the same day or after departure). Eg: D = [10, 7, 8, 8, 9] and R = [8, 10, 7, 8, 9] -> 14 (depart on day 2 and return on day 3).
Candidate's Approach
- For the first question, I implemented the solution for finding the next greater element and managed to solve the inclusive range problem after being prompted about handling duplicates.
- For the second question, I developed a solution that runs in O(n) time and O(n) space, but I was unable to achieve the O(1) space solution.
Interviewer's Feedback
No feedback provided.