Category Archives: Uncategorized
N-Queens – Python 3 (Week 19 – 02)
Solution 1 Time O(s*n^2). Space O(s). Solution 2 Improve time complexity to O(s*n). Because n is small, can not improve a lot.
Split String – Python 3 (Week 19 – 01)
Kth Largest Element – Python 3 (Week 18 – 12)
O(n) time, O(1) extra memory.
Partition Array – Python 3 (Week 18 – 11)
3Sum – Python 3 (Week 18 – 10)
Sort Colors II – Python 3 (Week 18 – 09)
Two Sum II – Input array is sorted – Python 3 (Week 18 – 08)
Sort Integers II – Python 3 ( Week 18 – 07)
Solution 1 quick sort Time O(nlogn). Space O(1). Solution 2 merge sort Time O(nlogn). Space O(n).
Remove Duplicate Numbers in Array – Python 3 ( Week 18 – 06)
Solution 1 O(n) time, O(n) space Solution 2 O(nlogn) time, O(1) space