Skip to content

Commit 89c8431

Browse files
authored
Update 2218-maximum-value-of-k-coins-from-piles.js
1 parent 4dc7c3b commit 89c8431

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

2218-maximum-value-of-k-coins-from-piles.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ const maxValueOfCoins = function(piles, k) {
3232
const memo = Array.from({ length: n + 1 }, () => Array(k + 1).fill(null))
3333
return helper(0, k)
3434

35+
// TC: O(n * m)
36+
// n: length of piles
37+
// m: sum(piles[i]), total elements of all piles
3538
function helper(i, k) {
3639
if(k == 0 || i === n) return 0
3740
if(memo[i][k] != null) return memo[i][k]

0 commit comments

Comments
 (0)