C++UnionFind與陣列版Linked list解Leetcode 1722 Minimize Hamming Distance After Swap Operations
真正的C++硬和解答,用 Union-Find解答Leetcode 1722. Minimize Hamming Distance After Swap Operations, 用兩個靜態陣列實作Linked List取代2D vector或是hash map
只要幾ms就run完了所有的testcases,當然是100%
-----
A true C++ hard-solution solution, using Union-Find to solve Leetcode 1722. Minimize Hamming Distance After Swap Operations, implementing a Linked List using two static arrays instead of a 2D vector or hash map. All test cases run in just a few milliseconds, achieving 100% completion.
[codes on Leetcode]https://leetcode.com/problems/minimize-hamming-distance-after-swap-operations/solutions/8020783/unionfind-with-counting-freq31ms-beats-1-r1lw/
[C++ UnionFind BFS DFS解圖論問題Leetcode 1971 Find if Path Exists in Graph]https://www.youtube.com/watch?v=B1GQlUN08lk
沒有留言:
張貼留言