Regular Expression Python: re Functions re.search(pattern, string, flags=0) 尋找string中第一個符合正則表達式 (regular expression) pattern的substring. 沒有則傳回 None. flags: class re.RegexFlag (配對正則表達式的選項, 忽略大小寫 ...
Problem https://leetcode.com/contest/weekly-contest-363/problems/maximum-number-of-alloys/ Solution: Binary Search Time Complexity: O(max((stock[m] + budget // cost[m]) // machine[m] for m in range(n) ...
Problem https://leetcode.com/contest/weekly-contest-363/problems/maximum-element-sum-of-a-complete-subset-of-indices/ complete(set_of_numbers) ← True, if ∀ x, y ∈ set_of_numbers, ∃ z ∈ ℕ s.t. x * y == ...
Problem https://leetcode.com/contest/weekly-contest-363/problems/happy-students/ if i ∈ selected ∧ len(selected) > nums[i] => ith student is happy if i ∉ selected ∧ len(selected) < nums[i] =& ...
Problem https://leetcode.com/contest/weekly-contest-363/problems/sum-of-values-at-indices-with-k-set-bits/ Solution Time Complexity: O(len(nums) * log(max(nums))) Space Complexity: O(1) (The input and ...
bin(x) 回傳 “0b” + x(2) 的字串 Time Complexity O(log(x)) References Python Docs: bin()
sudo apt remove python3-apt sudo apt autoremove sudo apt autoclean sudo apt install python3-apt
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python get-pip.py
wget https://www.python.org/ftp/python/x.y.z/Python-x.y.z.tgz 來源:https://www.python.org/downloads/source/ tar -xf Python-x.y.z.tgz cd Python-x.y.z ./configure --enable-optimizations make sudo make alt ...