Skip to content

Conversation

Madhu696969
Copy link

This pull request adds the 0/1 Knapsack algorithm implemented in Java using dynamic programming.

The code is easy to understand and well commented, so beginners can learn from it.

It solves the problem of selecting items to maximize value without exceeding the knapsack’s capacity.

An example test case is included in the main method to show how it works.

The file is added at src/main/java/dynamicprogramming/Knapsack.java.

Thank you for reviewing my contribution!

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 0% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.78%. Comparing base (4858ec9) to head (50095a6).

Files with missing lines Patch % Lines
src/main/java/dynamicprogramming/Knapsack.java 0.00% 17 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6814      +/-   ##
============================================
- Coverage     77.85%   77.78%   -0.07%     
+ Complexity     6359     6358       -1     
============================================
  Files           731      732       +1     
  Lines         21187    21204      +17     
  Branches       4140     4144       +4     
============================================
- Hits          16495    16494       -1     
- Misses         4034     4051      +17     
- Partials        658      659       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vil02
Copy link
Member

vil02 commented Oct 18, 2025

This is already implemented in Knapsack.java.

@vil02 vil02 closed this Oct 18, 2025
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.

3 participants