Time O(n). Space O(1).
Category Archives: Uncategorized
Count 1 in Binary – Python 3 (Week 13 -08)
strStr II – Python 3 (Week 13 – 07)
Solution 1 Rabin Karp Time O(m+n). Space O(1).
Longest Palindromic Substring – Python 3 (Week 13 – 06)
Solution 1 Expand Around Center Time O(n**2). Space O(1). Solution 2 DP Time O(n**2). Space O(n**2).
Shortest Word Distance III – Python 3 (Week 13 – 05)
Time O(n). Space O(1).
Reorganize String – Python 3 (Week 13 – 04)
heapq is a binary heap, with O(log n) push and O(log n) pop. Solution 1 Time O(n). Space O(1).
Lexicographical Numbers – Python 3 (Week 13 – 03)
Time O(n). Space O(1).
Find the nearest store – Python 3 (Week 13 – 02)
Time O(n log n ). Space O(n). n is len(stores) + len(houses).
Encode N-ary Tree to Binary Tree – Python 3 (Week 13 – 01)
Time O(h). Space O(h).
Minimum Depth of Binary Tree – Python 3 (Week 12 – 20)
Time O(d). Space O(d).