标签:leetcode python 面试题 algorithm
class Solution: # @param head, a ListNode # @return a boolean def hasCycle(self, head): if None == head or None == head.next: return False pfast = head pslow = head while pfast and pfast.next: pfast = pfast.next.next pslow = pslow.next if pfast == pslow: return True return False这个题是很经典的题,要我说什么,我也说不出什么,只是觉得这种算法(想法)和nb,仅此而已。
【leetcode】Linked List Cycle (python),布布扣,bubuko.com
【leetcode】Linked List Cycle (python)
标签:leetcode python 面试题 algorithm
原文地址:http://blog.csdn.net/shiquxinkong/article/details/37818869