September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,19 +1,19 @@
|
|||
function countcoins(t, o) {
|
||||
'use strict';
|
||||
var targetsLength = t + 1;
|
||||
var operandsLength = o.length;
|
||||
t = [1];
|
||||
'use strict';
|
||||
var targetsLength = t + 1;
|
||||
var operandsLength = o.length;
|
||||
t = [1];
|
||||
|
||||
for (var a = 0; a < operandsLength; a ++) {
|
||||
for (var b = 1; b < targetsLength; b ++) {
|
||||
for (var a = 0; a < operandsLength; a++) {
|
||||
for (var b = 1; b < targetsLength; b++) {
|
||||
|
||||
// initialise undefined target
|
||||
t[b] = t[b] ? t[b] : 0;
|
||||
// initialise undefined target
|
||||
t[b] = t[b] ? t[b] : 0;
|
||||
|
||||
// accumulate target + operand ways
|
||||
t[b] += (b < o[a]) ? 0 : t[b - o[a]];
|
||||
}
|
||||
}
|
||||
// accumulate target + operand ways
|
||||
t[b] += (b < o[a]) ? 0 : t[b - o[a]];
|
||||
}
|
||||
}
|
||||
|
||||
return t[targetsLength - 1];
|
||||
return t[targetsLength - 1];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue