Leetcode # 54. Spiral Matrix
https://leetcode.com/problems/spiral-matrix Solution Time Complexity: O(len(matrix) * len(matrix[0])) Space Complexity: O(len(matrix) * len(matrix[0])) (The input and output generally do not count tow ...
https://leetcode.com/problems/spiral-matrix Solution Time Complexity: O(len(matrix) * len(matrix[0])) Space Complexity: O(len(matrix) * len(matrix[0])) (The input and output generally do not count tow ...
https://leetcode.com/problems/non-overlapping-intervals First Solution Time Complexity: O(len(intervals)) Space Complexity: O(len(intervals)) (The input and output generally do not count towards the s ...
any(iterable): Return True if any element of an iterable is True all(iterable): Return True if all element of an iterable is True 範例 Leetcode # 1275. Find Winner on a Tic Tac Toe Game
https://leetcode.com/problems/find-winner-on-a-tic-tac-toe-game Solution Time Complexity: O(len(moves)) Space Complexity: O(len(row)) (The input and output generally do not count towards the space com ...
五花肉肥肉切丁 下鍋小火煸油 (香味來自豬油,相當重要) 醬油 五香粉 紅蔥頭 加剛剛的豬油開始滷肉燥
https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree-ii Solution: DFS Time Complexity: O(2 * len(tree)) = O(2 * len(tree)) Space Complexity: O(len(tree)) (The worst case is O(2 * len( ...
https://leetcode.com/problems/lru-cache Solution Time Complexity: O(capacity) Space Complexity: O(capacity) (The input and output generally do not count towards the space complexity.) class LRUCache: ...
https://leetcode.com/problems/roman-to-integer Solution Time Complexity: O(len(s)) Space Complexity: O(1) (The input and output generally do not count towards the space complexity.) class Solution: de ...
https://leetcode.com/problems/can-make-arithmetic-progression-from-sequence Solution Time Complexity: O(n) Space Complexity: O(n) (The input and output generally do not count towards the space complex ...
https://leetcode.com/problems/move-zeroes Solution Time Complexity: O(len(nums)) Space Complexity: O(1) (The input and output generally do not count towards the space complexity.) class Solution: def ...