We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
This is my code in Java7
static long getWays(long n, long[] c){ // Complete this function long[] combinations=new long[(int)n]; combinations[0]=1;
for(int j=0;j=c[j])
combinations[i]+=combinations[i-(int)c[j]];
}
}
return combinations[(int)n];
}
I am getting AArrayIndexOutOfBoundsException. Can anyone help ?
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
The Coin Change Problem
You are viewing a single comment's thread. Return to all comments →
This is my code in Java7 static long getWays(long n, long[] c){ // Complete this function long[] combinations=new long[(int)n]; combinations[0]=1; for(int j=0;j=c[j]) combinations[i]+=combinations[i-(int)c[j]]; } }
} I am getting AArrayIndexOutOfBoundsException. Can anyone help ?