摘要:
去Twitter面试的被问到这个问题,当时只想到了用HashMap的办法,这种办法时间复杂度O(n),空间复杂度是O(n), 更好的办法是用 FastRunner / SlowRunner approach。用两个pointer遍历链表,fast的速度是slow的两倍,如果有loop,二者一定会co... 阅读全文
摘要:
Partition an array of integers around a value such taht all elements less than x come before elements greater than or equal to x.Idea: Just use of sub... 阅读全文