Skip to content

min coin solution#118

Merged
dsope05 merged 2 commits into
llipio:masterfrom
dsope05:dan3
Aug 18, 2017
Merged

min coin solution#118
dsope05 merged 2 commits into
llipio:masterfrom
dsope05:dan3

Conversation

@dsope05
Copy link
Copy Markdown
Collaborator

@dsope05 dsope05 commented Aug 13, 2017

No description provided.

yjlim5
yjlim5 previously requested changes Aug 14, 2017
Comment thread solutions/56.js Outdated
arr.forEach((coin)=> {
let childCoins = 0;
if (value - coin > 0) {
childCoins = solution(arr, value - coin);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@drsoper you mean to call solution2

Comment thread solutions/56.js Outdated
if (value - coin > 0) {
childCoins = solution(arr, value - coin);
}
if ( childCoins < currentMin) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please try rewriting with Math.min function instead of the lines 42-44

Comment thread test/56.js
expect(solution([1, 2, 3, 6, 7], 12)).to.equal(2);
});
it('simplest case [1], total=1', () => {
expect(solution2([1], 1)).to.equal(1);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you call your solution2 right behind solution in line 9? Refer to how it was done in this test file: https://github.com/llipio/algorithms/blob/master/test/13.js

@dsope05 dsope05 dismissed yjlim5’s stale review August 14, 2017 20:28

i don't know how to put MR into "comments fixed" state

Comment thread solutions/56.js
if (value - coin > 0) {
childCoins = solution2(arr, value - coin);
}
currentMin = Math.min(currentMin, childCoins);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one comment for more concise code in the future: If value - coin is not greater than 0, than we do not need to currentMin.

Other than that, the changes are approved.

@yjlim5
Copy link
Copy Markdown
Collaborator

yjlim5 commented Aug 14, 2017

@dsope05, that's ok. I get email notification for the changes, and your new commits are clearly shown in this thread. You should leave the "Changes Requested" state as is, so that I can "Approve Changes" after taking a look. :)

@dsope05 dsope05 merged commit 8009870 into llipio:master Aug 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants