The interviewee had super good performance. He solved two algorithms, and one with optimal solution idea. He also shared with me his idea how to write bug free code for search in rotated sorted array. I do believe that he makes good suggestion.
1. Check loop invariant
2. Move the array with one node, two nodes, or three nodes outside while loop, as long as it is working. The good about solution is easy for you to check all edge cases.
No comments:
Post a Comment