DP and BFS use C++ to solve Leetcode 322 Coin Change for coin change.
Various solutions:
1. The greedy algorithm can only solve canonical currency
2. Euclidean algorithm can solve coins.length=2
3. DFS+DP can solve
4. Iterative DP can be solved quickly
5. BFS +visited marking can quickly solve
6 BFS can solve the problem by changing the queue to priority queue
[codes on Leetcode]https://leetcode.com/problems/coin-change/solutions/3680783/c-dp-vs-bfs-visited-gcd-beats-93-94/
==========
DP與BFS用C++解Leetcode 322 Coin Change換硬幣零錢。
多種解法:
1. greedy algorithm只能解canonical貨幣
2. Euclidean algorithm能解coins.length=2
3. DFS+DP能解
4. 迭代DP快速能解
5. BFS +visited marking能快速解
6 BFS將queue改成priority queue能解
沒有留言:
張貼留言