Time O(log(end)*(n+m)). Space O(logend).
Category Archives: Uncategorized
Topological Sorting – Python 3 (Week 14 – 06)
Solution 1 BFS Time O(n^2). Space O(n).
Knight Shortest Path – Python 3 (Week 14 – 05)
Time, Space O(nm).
Number of Islands – Python 3 (Week 14 – 04)
Time, Space O(n). n is number of grids
Word Ladder – Python 3 (Week 14 – 03)
Solution 1 分层 Time O(n*l + l^2). Space O(n*l). n is total number of words. l is the max length of word. Solution 2 不分层 Time O(n*l + l^2). Space O(n*l). n is total number of words. l is the max length of word. Solution 3 Bidirectional Breadth First Search Time O(n*l + l^2). Space …
Clone Graph – Python 3 (Week 14 – 02)
Time O(n +m). Space O(n). n is number of nodes, m is number of edges.
Binary Tree Level Order Traversal – Python 3 (Week 14 – 01)
Time, Space: O(n).
Rotate String II – Python 3 (Week 13 – 12)
Solution 1 Time O(n). Space O(n).
Subarray Sum Closest – Python 3 (Week 13 – 11)
Time O(nlogn). Space O(n).
Subarray Sum – Python 3 (Week 13 – 10)
Time O(n). Space O(1).