herrDeng網內搜尋
自訂搜尋
Ads
2024年12月5日 星期四
Python C C++ 2 pointer速解Leetcode 2337 Move Pieces to Obtain a String
Python C C++ 2 pointer速解Leetcode 2337 Move Pieces to Obtain a String
多日Leetcode的問題都可用2-pointer法來解,今日2337. Move Pieces to Obtain a String也不例外,這次就用C/C++/Python三個語言來解[Python解請進]
2024年11月18日 星期一
Python C++ sliding window速解Leetcode 1652 defuse the bomb
Leetcode的1652. Defuse the Bomb是絕佳的練習題,特別是針對Python的使用者,雖說是sliding window 是簡單的那種,還可練習loop, slicing, minus index etc .https://leetcode.com/problems/defuse-the-bomb/solutions/6056351/sliding-window-for-k-0-or-k-0-beats-100/
2024年11月9日 星期六
bitset C++ python解Leetcode 3133 Minimum Array End
bitset C++ python解Leetcode 3133 Minimum Array End
簡單地說就是把x和n-1的二進位塞成一個數字
-----------
Roughly speeaking, "pack" the binary expressions of x & n-1 into one number
2024年11月8日 星期五
XOR prefix sum C++ python解Leetcode 1829 Maximum XOR for Each Query
XOR prefixsum CPP python解Leetcode 1829 Maximum XOR for Each Query
其實這裡考慮的是元素個數為2^maximumBit的交換群,運算子為XOR。
[Python code請進]
2024年11月4日 星期一
2 pointer Python C++解Leetcode 3163 String Compression III
2 pointer Python C++解Leetcode 3163 String Compression III
[codes on Leetcode]https://leetcode.com/problems/string-compression-iii/solutions/6004059/string-with-2-pointers-3ms-beats-99-15/
[2-pointer/Sliding window play list]https://www.youtube.com/watch?v=--IlX3x54nk&list=PLYRlUBnWnd5KrCfs7qCFb-Bvn7dvnakFy
2024年11月2日 星期六
Colab上安裝中文字型修改股市爬蟲pyplot顯圖
Colab上安裝中文字型修改股市爬蟲pyplot顯圖
使用python套件:
numpy, requests. pyplot, matplotlib.font_manager, matplotlib.mpl
Python C++使用字串find迴圈速解Leetcode 2490 Circular Sentence
Python C++使用字串find迴圈速解Leetcode 2490 Circular Sentence
C++ & Python都有字串的find,用法都類似
split=s.find(' ', split+1)能找到s從index=split+1開始出現' '的第一個的index
[Python解請進, C++ 一行解]
2024年10月22日 星期二
C++ Python DFS與nth element( nlargest)Leetcode 2583 Kth Largest Sum in a...
Python C++ DFS與nth element nlargest解Leetcode 2583 Kth Largest Sum in a Binary Tree
用容器一次就配置大一點,寧可大一點不要不夠,解答的Code才會夠快。 解答快速程式簡單。
[Python解答請進]
----------
訂閱:
文章 (Atom)
熱門文章
-
明文=I'm student key=(2,15,8) 密文=?
-
C字串練習 字串 char word[]="You win!"; 輸出為: You win! You win You wi You w You You Yo Y 給進階使用者: gets () 是個危險的函式!
-
請用C/C++ 程式計算 S=1*1+2*2+3*3+4*4+.....+20*20=?
-
GCD(123456789,345634567)=?
-
計算你的BMI
-
array ex 1, 2,3,7,8
-
列印課表數字代碼矩陣,以及代碼的課名 提示: 參考此連結