MCPcopy Create free account
hub / github.com/careercup/ctci / makeChange2

Method makeChange2

java/Chapter 9/Question9_8/Question.java:22–26  ·  view source on GitHub ↗
(int n)

Source from the content-addressed store, hash-verified

20 }
21
22 public static int makeChange2(int n) {
23 int[] denoms = {25, 10, 5, 1};
24 int[][] map = new int[n + 1][denoms.length];
25 return makeChange2(n, denoms, 0, map);
26 }
27
28 public static int makeChange2(int amount, int[] denoms, int index, int[][] map) {
29 if (map[amount][index] > 0) { // retrieve value

Callers 1

makeChangeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected