herrDeng網內搜尋

自訂搜尋

Ads

2024年1月23日 星期二

C++遞迴試所有組合bitset解Leetcode 1239 Maximum Length of a Concatenated String ...


C++遞迴試所有組合bitset解Leetcode 1239  Maximum Length of a Concatenated String with Unique Characters。這個用遞迴試所有的組合,不想用unordered_set, unordered_map,  討厭的edge case,誤解題意,修正完就用 bitset好用,如此100%的code就完成了
-----
C++ Recursively try all combinations and bitset solutions Leetcode 1239 Maximum length of a concatenated string with unique characters. This uses recursion to try all combinations. I don't want to use unordered_set, unordered_map. After encountering the  annoying edge cases  it is clear that I misunderstood the meaning of the problem. After correction, use bitset which is very efficient. This way, the code beats 100%  of users with C++ in speed.

沒有留言:

Related Posts Plugin for WordPress, Blogger...

熱門文章