聲樂課* 2022/07/30
- 2022.07.30
- 聲樂
發聲練習 唱 12345432, 12345432, 123454321 一開始是唱 u~, o~, a~; 因為 u 的位置錯誤改唱 o~, a~, u~ 體會 u 的正確位置
發聲練習 唱 12345432, 12345432, 123454321 一開始是唱 u~, o~, a~; 因為 u 的位置錯誤改唱 o~, a~, u~ 體會 u 的正確位置
https://leetcode.com/problems/word-break/ Dynamic Programming Time Complexity: O(len(s) ^ 3) Space Complexity: O(len(s)) ※ 上述複雜度也能以 Recursion wt/ Memoization 或 Depth-First Search(以 word 為節點單位)達成 class ...
https://leetcode.com/problems/trapping-rain-water/ Solution Time Complexity: O(len(height)) Space Complexity: O(1) class Solution: def trap(self, height: List[int]) -> int: i, j = 0, len(height) - ...
https://leetcode.com/problems/min-cost-climbing-stairs/ Solution Time Complexity: O(n) Space Complexity: O(1) ※ 參考 Leet Code #198. House Robber class Solution: def minCostClimbingStairs(self, cost: L ...
https://leetcode.com/problems/reverse-linked-list-ii/ Solution 注意和 Leetcode # 206. Reverse Linked List 相同的多重賦值順序問題 Time Complexity: O(n) Space Complexity: O(1) class Solution: def reverseBetween(self, ...
用一個等號同時為多個變數賦值 x = a, y = b x, y = a, b 計算順序 a, b = c, d 計算 c, d 賦值 c 給 a 賦值 d 給 b 實現「數值交換 (Swap)」 a, b = b, a 因為在賦值給 a, b 之前,已經先計算過了 b, a 所以在賦值給 b 時,不會因為 a 已經改變過數值而被影響 因為計算順序而出錯的範例 Leetcode # 203. ...
https://leetcode.com/problems/number-of-matching-subsequences/ Brute-force (Time Limit Exceeded) Time Complexity: O(len(s) * len(words)) 在檢查 s 的每一個字元時 都要遍歷 words 一次 浪費太多不必要的時間 class Solution: def numM ...
https://leetcode.com/problems/delete-nodes-and-return-forest/ Solution class Solution: def delNodes(self, root: Optional[TreeNode], to_delete: List[int]) -> List[TreeNode]: to_delete = set(to_delet ...
https://leetcode.com/problems/find-in-mountain-array/ 相關例題 Leetcode # 852. Peak Index in a Mountain Array Solution 先找到山頂(參考 Leetcode # 852. Peak Index in a Mountain Array ) 從山頂將 array 一分為二 各別做 binary ...
https://leetcode.com/problems/peak-index-in-a-mountain-array/ Solution 如果只用三點來判斷是否為 mountain array 容易發生如上圖的誤判 所以使用斜率,來判斷中點位於上坡或下坡 Time Complexity: O(log(len(arr))) Space Complexity: O(1) class Solutio ...