摘要:
Complexity Analysis Time Complexity: O(M + N)O(M+N), where M, NM,N are the lengths of S and T respectively. Space Complexity: O(1)O(1). Time Complexit 阅读全文
摘要:
Greedy Use two pointers, one for source: i, one for target: j. While j scan through target, try to match each char of j in source by moving i. Count h 阅读全文
摘要:
1. The final uniform character should be either A[0] or B[0] 2. A[0] could be at the top, or the bottom. Same applies to B[0] 3. If A[0] works, no nee 阅读全文
摘要:
Facebook / Eng tech lead Dec 30, 2018 68 Comments Facebook / Eng tech lead Facebook / Eng tech lead Dec 30, 2018 68 Comments New Year Gift to every fe 阅读全文
摘要:
Quick Sort Way: We can use quick sort technique to solve this. We represent nuts and bolts in character array for understanding the logic. Nuts repres 阅读全文
摘要:
这道题应该是how to bipartite a graph Taken from GeeksforGeeks Following is a simple algorithm to find out whether a given graph is Birpartite or not using B 阅读全文
摘要:
1. 根据系统设计的Estimation of the amount of data we need to store for the next couple of years, 我们应需要6位Base62的char来encode 2. assume 避免地址爆炸,相同的longUrl得到相同的sh 阅读全文
摘要:
Each time, first add the direction to the path, and then go with that direction, checking for hole along the way. When hit a wall, try to turn, and go 阅读全文
摘要:
Solution of The Maze: https://discuss.leetcode.com/topic/77471/easy-understanding-java-bfs-solutionSolution of The Maze III: https://discuss.leetcode. 阅读全文
摘要:
Search in the four possible directions when coming to a stopping point (i.e. a new starting point). Keep track of places that you already started at i 阅读全文
摘要:
未研究: The idea is to keep a window [l, h] that contains at most k zero The following solution does not handle follow-up, because nums[l] will need to a 阅读全文
摘要:
还没研究: For example, given IDIIDD we start with sorted sequence 1234567Then for each k continuous D starting at index i we need to reverse [i, i+k] port 阅读全文