/* 自定義代碼塊樣式 */

herrDeng網內搜尋

自訂搜尋

Ads

顯示具有 C程式設計 標籤的文章。 顯示所有文章
顯示具有 C程式設計 標籤的文章。 顯示所有文章

2026年6月24日 星期三

Beats 100%|C/C++矩陣冪次方解Leetcode難題3700 Number of ZigZag Arrays II


Beats 100%|C/C++矩陣冪次方解Leetcode難題3700  Number of ZigZag Arrays II
在這段影片中,我將深入解析如何使用 矩陣快速冪 (Matrix Exponentiation) 來高效解決 LeetCode 難題 3700:Number of ZigZag Arrays II。這題是 ZigZag Array 系列的進階版本,對時間複雜度有極高要求。

2026年6月16日 星期二

C, Py3, C++解Leetcode 3612 與難題3614 Process String with Special Operations


C Py3 C++解Leetcode 3612 與難題3614 Process String with Special Operations
一個字串問題Leetcode 3612,用C++或Python是易如反掌,用C語言就難多了,然而這個解題經驗,順便用來解所謂hard 3614. Process String with Special Operations II

2026年5月6日 星期三

2026年1月24日 星期六

計數排序與greedy 2 pointer解Leetcode 1877 Minimize Maximum Pair Sum in Array


計數排序與greedy 2 pointer解Leetcode 1877  Minimize Maximum Pair Sum in Array 重點是理解為何Greedy方法可行,code很簡單,就排序sort, counting sort, radix sort都來一遍
[Py3 一行解請進]

2025年11月27日 星期四

2025年10月30日 星期四

2025年9月16日 星期二

C C++ GCD LCM解Leetcode難題2197 Replace Non Coprime Numbers in Array[含Py3 code]


C C++ GCD LCM解Leetcode難題2197  Replace Non Coprime Numbers in Array
用binary Euclidean algorithm定義gcd,然後定義lcm之後就是用stack
[Py3 code請進]

2025年9月6日 星期六

C++C py3 log4 prefix sum, bits解Leetcode難題3495 Minimum Operations to Mak...


C++C py3 log4 prefix sum/bits解Leetcode難題3495  Minimum Operations to Make Array Elements Zero
ceil(log4(x)) 可以透過 clz 計算;將 expSum 定義為部分和來計算。
[Py3 code請進]

2025年5月17日 星期六

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年6月2日 星期日

C++ Python C速解Leetcode 344 Reverse String


C++ Python C速解Leetcode 344  Reverse String
交換索引對 (i, n-1-i)。在C的實作中,交換並沒有使用額外的空間,只是透過xor!

2024年4月20日 星期六

C++ DFS BFS貪婪三法解Leetcode農地問題1992 Find All Groups of Farmland


C++ DFS BFS貪婪三法解Leetcode農地問題1992  Find All Groups of Farmland
採用三種方式解題,一是DFS, 二是BFS,前兩法都很標準。農地因為都是矩形,第三法採貪婪演算找出矩形右下角,簡單又快速。

2024年4月5日 星期五

python C++速解Leetcode 1544 make the string great


python C++速解Leetcode 1544 make  the string great
基本上算是stack解法,但實作的語言C, C++, python只需要善用個別字串的特性,無須使用stack,大幅加快計算速度,C語言解答請進,並加上最佳C++解

2024年3月8日 星期五

python C C++陣列迴圈速解Leetcode 3005 Count Elements With Maximum Frequency


python C C++陣列迴圈速解Leetcode 3005  Count Elements With Maximum Frequency
陣列迴圈就能解答的,何須用到hash table(C++ unordered_map)簡單的問題可用簡單的 資料結構解答,迴圈就是迴圈、陣列就是陣列(內有python code)

2024年3月3日 星期日

python C C++速解Leetcode 19 Remove Nth Node From End of List並考慮memory leaks問題


python C C++速解Leetcode 19 Remove Nth Node From End of List並考慮memory leaks問題
其實刷題不要只是貪快還是要考慮Memory Leaks,解老題目19 Remove Nth Node From End of List要特別別考慮,另別是C/C++使用者

2024年2月22日 星期四

python C++計算 indegree解Leetcode 997 Find the Town Judge


python C++計算 indegree解Leetcode 997  Find the Town Judge
使用圖形解決方案。
由於信任中的每一對 e=(a, b) 實際上表示一種信任關係,可以將其視為有向邊。C++程式請進
---
Related Posts Plugin for WordPress, Blogger...

熱門文章