herrDeng網內搜尋

自訂搜尋

Ads

2025年7月6日 星期日

C++ Py3 hashmap與binary search解Leetcode 1865 Finding Pairs With a Certain...



C++ Py3 hashmap與binary search解Leetcode 1865 Finding Pairs With a Certain Sum
基本上用 hashmap。解釋為什麼要使用排序和二元搜尋找來優化程式碼
-----
Basically use hashmap. Explain why  one should use sorting and binary search to optimize the code.

2025年6月28日 星期六

Py3排序 C++nth_element速解Leetcode 2099 Find Subsequence of Length K With t...


Py3排序 C++nth_element速解Leetcode 2099  Find Subsequence of Length K With the Largest Sum
C++的nth_element很好用,基本上是做partition,在這個問題可取代sort
----
C++'s nth_element is very useful. It basically does partitioning and can replace sort in this problem.

2025年6月19日 星期四

Py3 C++計數排序counting sort解Leetcode 2294 Partition Array Such That Maximu...

Py3 C++計數排序counting sort解Leetcode 2294  Partition Array Such That Maximum Difference Is K
基本上使用Greedy sort,而排序就用counting sort
[Python C++計數排序與一行解Leetcode 1051 Height Checker]https://www.youtube.com/watch?v=dybiq3pg-Os

2025年6月1日 星期日

C++Py3重複組合排容原理解Leetcode2929 Distribute Candies Among Children II

C++Py3重複組合排容原理解Leetcode2929  Distribute Candies Among Children II
Use combinatorial number with repetition & Inclusion-Exclusion Prinple to solve
[Py3解請進]
Related Posts Plugin for WordPress, Blogger...

熱門文章