Grokking LinkedIn Coding Interview
Ask Author
Back to course home

0% completed

Vote For New Content
Isn't more efficient take advantage that the array is sorted and binary search t...

JFB

Aug 24, 2022

Isn't more efficient take advantage that the array is sorted and binary search the missing number in the search pair method?

0

0

Comments
Comments
Design Gurus
Design Gurus3 years ago

How?

While searching for a pair, you can iterate all numbers and for each number find the other number using binary search. This algorithm will take O(N * logN).

The implementation we have given is taking O(N).

On this page