Interviewer was expecting O(N) solution for N asks.

Edits: Interviewer was expecting O(N) Time + O(1) avg case space complexity solution for N asks.

and integers are not given in a array, every time only one integer will be passed as input to your method.