[Ubuntu] No module named ‘apt_pkg’
- 2023.09.19
- Linux Python Ubuntu 22.04
sudo apt remove python3-apt sudo apt autoremove sudo apt autoclean sudo apt install python3-apt
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 回傳插入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[, lo=0, hi=len(a), *, key=None]) ...
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 ...
Problem https://leetcode.com/problems/find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree Solution: DFS n := number of nodes in the original tree Time Complexity: O(n) Space Complexity: ...
Problem https://leetcode.com/problems/kth-ancestor-of-a-tree-node First Solution: Binary Lifting [Time Limit Exceeded 8 / 17 testcases passed] Time Complexity: O(n ** 2) __init__(): worst case – ...
Problem https://leetcode.com/contest/weekly-contest-361/problems/minimum-edge-weight-equilibrium-queries-in-a-tree/ There is an undirected tree with n nodes labeled from 0 to n – 1. You are give ...