https://leetcode.com/contest/weekly-contest-356/problems/number-of-employees-who-met-the-target/ Solution Time Complexity: O(len(hours)) Space Complexity: O(len(hours)) (The input and output generally ...
https://leetcode.com/contest/weekly-contest-356/problems/count-complete-subarrays-in-an-array/ Solution Time Complexity: O(len(nums)) Space Complexity: O(len(nums)) (The input and output generally do ...
https://leetcode.com/contest/weekly-contest-356/problems/shortest-string-that-contains-three-strings/ Solution Time Complexity: O() Space Complexity: O() (The input and output generally do not count t ...
min(..., key=lambda s: (len(s), s)) Ref: Lexicographic Order
https://leetcode.com/problems/missing-element-in-sorted-array Solution Time Complexity: O(len(nums)) Space Complexity: O(1) (The input and output generally do not count towards the space complexity.) ...
https://leetcode.com/problems/soup-servings Solution: DP, Bottom-Up 湯a 數量為 na ,湯b 數量為 nb ma := ceil(na / 25) mb := ceil(nb / 25) dp[ma][mb] 則為回傳的答案 dp[0][0] = 0.5 ma == 0, mb > 0 ⇒ dp = 1 ma > 0 ...
global global_stmt ::= "global" identifier ("," identifier)* 在 global 中宣告的此層級中的 identifier(s) 將會對應為 global 變數 例: counter = 0 def func_a(): global counter counter += 2 print('func_a counter ...
字母/國際音標 對照 Alphabet IPA a a stock [stak] ɑ hot [hɑt] an ɑ̃ b b c s d e e may [meː] ɛ bed [bɛd] ə eu ø en ɑ̃ f g h i i j j k l l m n n o o yawn ...
str vs list c in [“c0“, “c1“, “c2“, …] c in “c0c1c2…”
https://leetcode.com/problems/predict-the-winner Solution (Recursive) Time Complexity: O(2 ** len(nums)) Space Complexity: O(len(nums)) (The input and output generally do not count towards the space c ...