受保護的內容: My Strengths
- 2023.08.01
- 日常生活
受密碼保護的文章不會產生內容摘要。
受密碼保護的文章不會產生內容摘要。
https://leetcode.com/problems/minimum-ascii-delete-sum-for-two-strings Failed Solution (Time Limit Exceeded) 讓我們來看看這個 solution 的 time complexity O(len(s1) * len(s2) + min(len(s1), len(s2)) * len(s1) * ...
<img style="display: block;" src=... /> #LeftCurlyBrace
https://leetcode.com/problems/strange-printer Solution (DP, Bottom-Top) Dynamic Programming dp[l][r] := The minimum number of operations needed to transform [s[r]] * (r - l + 1) into s[l:r + 1] = if ...
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 ...