Hy傢伙,出於某種原因,我的貪婪硬幣更改程序不起作用。該函數應返回最小數量的硬幣,您可以更改一個值,並且還有一個數組,其中包括可用於此的硬幣。我的程序沒有顯示任何內容,我不知道爲什麼。 public class Main {
public static int coinChangeGreedy(int[] coins, int n) {
int result = 0;
我已經想出了算法來找到數組中的非相鄰元素的最大總和,但我有一些麻煩找到哪些數字是摘取總結。這裏是我的最大總和(不包括一些初始化)算法: int n; //number of cells. Cells are labeled from 1 to n
int num[]; // all the numbers
int findMax[]; // findMax[i] equals to the c