摘要:
链表中的双/多指针问题,环的问题 一、Find the Middle Node 1 def find_middle(lst): 2 assert lst.head is not None and lst.head.next is not None 3 4 head = lst.head 5 fast 阅读全文
摘要:
#懒汉式,线程安全 public class Singleton{ private static Singleton instance; private Singleton(){} public static synchronized Singleton getInstance(){ if (ins 阅读全文
摘要:
1 #A reentrant lock must be released by the thread that #acquired it. Once a thread has acquired a reentrant lock, the #same thread may acquire it aga 阅读全文
摘要:
001.Two Sum 一、bruteforce:O(n**2) O(1) 二、两边哈希表、一遍哈希表 O(n) O(n) 015.Three Sum 一、bruteforce:O(n**3) O(1) 二、排序+双指针:O(n**2) 去重/剪枝 Four Sum 排序+双层循环+双指针 020. 阅读全文