#dynamicprogramming 動態規劃與 #BFS 廣度搜尋用C++解Leetcode 322 Coin Change換硬幣零錢。這並未考慮台灣人換零錢的方式也可以是負的,如4=5-1。多種解法:
1. greedy algorithm只能解canonical貨幣
2. Euclidean algorithm能解coins.length=2
3. DFS+DP能解
4. 迭代DP快速能解
5. BFS +visited marking能快速解
6 BFS將queue改成priority queue能解
[LeetCode程式] • C語言版的井字遊戲 TicTacTao(上)
================
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-ch...
---------------------