Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Knapsack #700

Merged
merged 4 commits into from
Jun 15, 2024
Merged

Add Knapsack #700

merged 4 commits into from
Jun 15, 2024

Conversation

kahgoh
Copy link
Member

@kahgoh kahgoh commented Jun 14, 2024

This is one of the 48in24 exercises.

@kahgoh kahgoh force-pushed the exercise/knapsack branch 3 times, most recently from 6ec0041 to 258064a Compare June 14, 2024 14:44
Copy link
Contributor

@jiegillet jiegillet left a comment

Choose a reason for hiding this comment

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

Fantastic, thank you for the contribution!
I left a bunch of nitpicks because I'm a grumpy nitpicky man, but I'll be happy to merge this :)

exercises/practice/knapsack/src/Knapsack.elm Outdated Show resolved Hide resolved
exercises/practice/knapsack/tests/Tests.elm Outdated Show resolved Hide resolved
"slug": "knapsack",
"name": "Knapsack",
"uuid": "9bf186d3-e904-42f2-a705-dffbe98adb08",
"practices": [],
Copy link
Contributor

Choose a reason for hiding this comment

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

[You don't need to do anything here] This is also a good candidate for #692

exercises/practice/knapsack/.meta/src/Knapsack.example.elm Outdated Show resolved Hide resolved
exercises/practice/knapsack/.meta/src/Knapsack.example.elm Outdated Show resolved Hide resolved
exercises/practice/knapsack/.meta/src/Knapsack.example.elm Outdated Show resolved Hide resolved
exercises/practice/knapsack/.meta/src/Knapsack.example.elm Outdated Show resolved Hide resolved
config.json Outdated
"lists",
"records"
],
"difficulty": 6
Copy link
Contributor

Choose a reason for hiding this comment

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

Feel like a 7 or an 8, because the algorithm isn't trivial. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think a 7 is also reasonable. My hesitance with going to an 8 is seeing Zebra puzzle at 8 (and me thinking its not quite as hard Zebra Puzzle). The other thought I have is this example solution uses memoization. A simpler solution could be to use recursion without the memoization (although it won't be as efficient).

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes you're right, it's not quite a Zebra puzzle.
In the end it's not an exact science, but 7 feels right :)

@kahgoh
Copy link
Member Author

kahgoh commented Jun 15, 2024

Thanks for the review @jiegillet! I was happy with the suggestions and have pushed the updates.

Copy link
Contributor

@jiegillet jiegillet left a comment

Choose a reason for hiding this comment

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

Very nice, thanks again.

@jiegillet jiegillet merged commit 1017f1a into exercism:main Jun 15, 2024
6 checks passed
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