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 ...
Setting Up RUST Server on Ubuntu 22.04 2023/10/18 創立並 CD 至 {RustServer} 資料夾 照著 LinuxGSM_: RUST Dependencies Install CD 至 {RustServer}/lgsm/config-lgsm/rustserver cp _default.cfg rustserver.cfg 編輯 rust ...
bisect(), insort() bisect(), bisect_left() 回傳插入x的index ( O(long(n)) ),保持a的排序 (a是個已排序 list ) 若x已存在a中則index會在a中的所有x的右/左邊 bisect.bisect(a, x[, lo=0, hi=len(a), *, key=None]) ≡ bisect.bisect_right(a, x[, ...
Problem https://leetcode.com/problems/minimum-array-length-after-pair-removals Testcases # Input Expected 1 [1,1] 2 2 [1,2] 0 3 [1,2,2] 1 4 [1,1,2,3,4,4] 0 Failed Solution: Greedy [Wrong Answer 338 ...
Shallow copy: To construct a new compound object and then (to the extent possible) insert references into it to the objects found in the original. Deep copy: To construct a new compound object and the ...