Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Follow up:Can you solve it without using extra space? Hide Tags Linked List Two Pointers 开始犯二了一点,使用了node 的val 作为判断,其实是根据内存判断.找出链表环的起始位置,这个画一下慢慢找下规律
def incSeq(seq): start = 0 for i in xrange(1, len(seq)): if seq[i] < seq[i-1]: yield start, i - start start = i maxIncSeq = reduce(lambda x,y: x if x[1]>y[1] else y, incSeq(seq)) 得到最长递增子串长度及起始位置,时间复杂度O(n).