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

herrDeng網內搜尋

自訂搜尋

Ads

2023年7月16日 星期日

DP動態規劃與bit遮罩C++解Leetcode 1125小而夠的團隊Smallest Sufficient Team




DP動態規劃與bit遮罩C++解Leetcode 1125小而夠的團隊Smallest Sufficient Team
這段程式碼使用動態規劃來找出擁有所有所需技能的最小足夠團隊。它使用二進位遮罩表示技能,並遍歷所有可能的團隊成員組合來找到最佳解。

2023年7月8日 星期六

Python/C++ Geedy演算完美切割解難題Leetcode 2551 Put Marbles in Bags


Geedy演算完美切割解難題Leetcode 2551 Put Marbles in Bags 要找到所有切割的最大和最小score,可以使用兩種方法:排序切割score(partition[i] = weights[i] + weights[i+1])或使用堆(C++ priority_queue)。一旦score排序或存儲在堆中,就可以輕鬆識別最大和最小score。

2023年7月5日 星期三

backtracking solves 8 queens by C++八后問題展示回遡解答


backtracking solves 8 queen by C++. Visualize the solving process by own C++/openCV program. Base on my C++ code solving Leetcode 51. N-Queens. There are exact 92 solutions for 8 queens. Some of them will be shown.

2023年7月1日 星期六

C++/Python DP動態規劃與bit遮罩解Leetcode 2305公平分餅乾 Fair Distribution of Cookies


C++/Python DP動態規劃與bit遮罩解Leetcode 2305公平分餅乾 Fair Distribution of Cookies 程式中使用了具有備忘錄的動態規劃。透過考慮每個袋子中不同子集的餅乾,程式遞迴地計算最小的不公平度。

2023年6月30日 星期五

BFS Minheap waterway solves #Leetcode 1970 Last Day Where You Can Still ...


BFS最小堆水路解Leetcode 1970 "最後一天你仍然可以穿越"的隨機測試案例。 使用C++/OpenCV將解方視覺化。核心想法是找到從第1欄到第col欄的連通水路。水路要用8個方向才可切斷陸路。
Related Posts Plugin for WordPress, Blogger...

熱門文章