https://leetcode.com/problems/search-in-rotated-sorted-array Solution n := len(nums) nums = [numk, numk+1, …numn-1] + [num0, num1, …, numk-1] = numsA + numsB numi < numj, if i < j; 0 ...
https://leetcode.com/problems/encode-and-decode-strings Solution Time Complexity: O(len(s)) Space Complexity: O(len(strs)) (The input and output generally do not count towards the space complexity.) c ...
https://leetcode.com/problems/longest-common-subsequence Solution: Top-Down DP Time Complexity: O(len(text1) * len(text2)) Space Complexity: O(len(text1) * len(text2)) (The input and output generally ...
https://leetcode.com/problems/maximum-score-from-performing-multiplication-operations Solution: Top-Down DP m := len(multipliers) n := len(nums) (end – start) = n – 1, n -2, …, n ...
https://leetcode.com/problems/house-robber-ii Solution _rob() := 必定搶最後一間的收益 結果 := max(搶最後一間, 不搶最後一間) = max(搶最後一間 and 不搶第一間, 不搶最後一間) = max(_rob(nums[1:]), robs(nums[:-1])) Time Complexity: O ...
https://leetcode.com/problems/delete-and-earn Solution Time Complexity: O(len(nums)) Space Complexity: O(len(counter)) (The input and output generally do not count towards the space complexity.) class ...
https://leetcode.com/problems/n-th-tribonacci-number Solution Time Complexity: O(n) Space Complexity: O(n) (The input and output generally do not count towards the space complexity.) class Solution: d ...
https://leetcode.com/contest/biweekly-contest-110/problems/minimum-seconds-to-equalize-a-circular-array/ Solution 解這題的心路歷程 找平均值 ⇒ [8,13,3,3] → 找眾數.⇒ [1,11,11,11,19,12,8,7,19] → 接觸到鄰居最多的數 ⇒ [8,14,10,6 ...
Ctrl + a 移動到行首 Ctrl + e 移動到行尾
echo $SHELL ⇒ /bin/zsh nano ~/.zshrc export PATH=${PATH}:...新的路徑... 重新開機 或 source .zshrc