Leetcode # 735. Asteroid Collision
https://leetcode.com/problems/asteroid-collision Solution Time Complexity: O(len(asteroids)) Space Complexity: O(len(asteroids)) (The input and output generally do not count towards the space complexi ...
https://leetcode.com/problems/asteroid-collision Solution Time Complexity: O(len(asteroids)) Space Complexity: O(len(asteroids)) (The input and output generally do not count towards the space complexi ...
\begin{align} & Diagnal & := \ & matrix[i][i] & \text{ for } i = 0, 1, …, n \\ & Anti-diagnal & := \ & matrix[i][n – i] & \text{ for } i = 0, 1, …, n ...
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 ...