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.
[codes on Leetcode]https://leetcode.com/problems/maximum-length-of-a-concatenated-string-with-unique-characters/solutions/4611659/c-recursion-with-bitset-0ms-beats-100/
[Leetcode playList]https://www.youtube.com/watch?v=KHVXYo7LxZE&list=PLYRlUBnWnd5IdDHk2BjqXwesydU17z_xk
[Dynamic Programming Playlist]https://www.youtube.com/watch?v=30yq3fmE6E8&list=PLYRlUBnWnd5K_XYUesV9oc6M9ONXII61T
沒有留言:
張貼留言