摘要:
def find_middle(self): if not self._head or self._head.next is None: return self._head fast, slow = self._head, self._head fast = fast.next while fast 阅读全文
摘要:
# 删除链表倒数第n个节点。假设n大于0 def remove_nth_from_end(head): fast = head count = 0 while fast and count < n: fast = fast._next count += 1 if not fast and count 阅读全文
摘要:
为啥一定会相遇呢,可以看这个:为什么用快慢指针找链表的环,快指针和慢指针一定会相遇? 代码: def has_cycle(self): fast, low = self._head, self._head while fast and fast.next: low = low.next fast = 阅读全文
摘要:
命令行如何带上密码? 可以参考stackoverflow里这个回答: postgresql-scripting-psql-execution-with-password 里面写道: "The obvious way is via the password prompt Instead of that 阅读全文