https://leetcode.com/problems/all-possible-full-binary-trees Solution n 個節點的 Full Binary Tree 種類數是 C(n – 1) / 2 C(n – 1) / 2 亦是 time complexity 而每一種 Full Binary Tree 都會花費 n 的空間建立 所以 space ...
https://leetcode.com/problems/combinations Solution (Backtracking) \begin{align} &\text{Time Complexity: }O(k \cdot \text{C}^n_k)\\ &\text{Space Complexity: }O(k)\\ \end{align} _combine([1, 2, ...
due to adjective prep. (modifies only pronouns and nouns) ex: His defeat was due to the rain. because of adverb prep. (modifies verbs) ex: He was defeat because of the rain.
受密碼保護的文章不會產生內容摘要。
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 ...