Finish the No.1 questions in CTCI

It's time complexity is O(N^2), it'a flaw.