[書道] 主筆
- 2025.08.21
- 雜談
橫(一) 豎 撇捺 豎鉤 斜鉤 臥勾 豎曲勾 走之底(辶 ㄔㄨㄛˋ) 四點火(灬 ㄏㄨㄛˇ) 宀 ㄇㄧㄢˊ / 點橫鉤(冖 ㄇㄧˋ)
橫(一) 豎 撇捺 豎鉤 斜鉤 臥勾 豎曲勾 走之底(辶 ㄔㄨㄛˋ) 四點火(灬 ㄏㄨㄛˇ) 宀 ㄇㄧㄢˊ / 點橫鉤(冖 ㄇㄧˋ)
Problem https://leetcode.com/problems/power-of-three Solution ⚠️ 注意 if 順序 if n == 1: return True if n < 1 or n % 3 != 0: return False if n < 1 or n % 3 != 0: return False if n == 1: return True ...
Problem https://leetcode.com/problems/reordered-power-of-2 Solution The leading digit is not zero. ⇒ 只要檢驗與 n 等長的 2k 1 <= n <= 109 ⇒ ∀ i = 0, 1, 2, …, 9; Counter(str(n))[str(i)] ≤ 9 x_code ...
Problem https://leetcode.com/problems/range-product-queries-of-powers Solution 求模倒數:費馬小定理 ⚠️ 用 pow(a, p – 2, p) 取代 (a ** (p – 2)) % p (products[l – 1] ** MODULUS_MINUS_2) % MODULUS p ...
Problem https://leetcode.com/problems/find-the-maximum-number-of-fruits-collected Solution: Bottom-Up DP (Tabulation) The children will make exactly n - 1 moves to reach the room (n - 1, n - 1) ⇒ chil ...
Problem https://leetcode.com/problems/find-smallest-common-element-in-all-rows Solution: Binary Search Time Complexity: O(len(mat) * log(len(mat[0]))) Space Complexity: O(1) (The input and output gene ...
Problem https://leetcode.com/problems/power-of-two Solution Time Complexity: O(log(n)) Space Complexity: O(1) (The input and output generally do not count towards the space complexity.) class Solution ...
Problem https://leetcode.com/problems/binary-tree-vertical-order-traversal Solution: BFS Time Complexity: O(len(tree)) Space Complexity: O(len(tree)) (The input and output generally do not count towar ...
Problem https://leetcode.com/problems/fruit-into-baskets Solution: Sliding Window Time Complexity: O(len(fruits)) Space Complexity: O(1) (The input and output generally do not count towards the space ...
chrome://settings/content/all