Time O(n). Space O(1).
Category Archives: Uncategorized
LintCode 8 Rotate String – Python 3 ( Week 11 – 11)
Time O(n). Space O(1).
Recover Rotated Sorted Array – Python 3 ( Week 11 – 10)
Solution 1 Time O(n). Space O(1).
Median of two Sorted Arrays – Python 3 ( Week 11 – 09)
Solution 1 Time O(logmn). Space O(1). Solution 2 Time O(logT *log(m+n))
Merge Sorted Array – Python 3 ( Week 11 – 08)
Time O(n + m). Space O(1).
Remove Duplicates from Sorted Array II – Python 3 ( Week 11 – 07)
Time O(n). Space O(1).
Find Minimum in Rotated Sorted Array II – Python 3 ( Week 11 – 06)
Time O(logn). Space O(n).
Search in Rotated Sorted Array II – Python 3 ( Week 11 – 05)
class Solution: def search(self, nums: List[int], target: int) -> bool: for num in nums: if num == target: return True return False Time O(n). Space O(1).
Search in Rotated Sorted Array – Python 3 ( Week 11 – 04)
Solution 1: One BS Time O(logn). Space O(1). Solution 2: 2 BF
Add Digits – Python 3 (Week 11 – 03)
Solution 1 Solution 2 Time complexity: O(n), assume n is the # of digits in the input. Space O(1).