Vahak | phone | Find the Duplicate Number
Anonymous User
499

I had an hour Vahak phone screen on 28/06/2021 for senior software engineer at Bengaluru office. I was asked 2 question.

1st question: https://leetcode.com/problems/find-the-duplicate-number with some modifications.
There could be more than 1 duplicate but the first duplicate will be considered as result.
Constraints: Time complexity O(N), and Space Complexity O(1)

2nd question: It was further modification of 1st question. array of length n with array elements range is [-n, n] (with value 0 excluded). There can be more than 1 duplicate but the first duplicate will be considered as result
Constraints: Time complexity O(N), and Space Complexity O(1)

I was able to solve the 1st question with given constraints but couldn't solve the second one.

Comments (1)