Skip to content

Conversation

sozelfist
Copy link
Contributor

Improve code readability, maintainability and edge case handling.

  • Correctly throws an error if the length of the weights and values arrays are not equal
  • Use camelCase consistently through the codebase
  • Add type annotations to the function params and return types
  • Adding comments within the loops to clarify the logic
  • Ensure your function handles edge cases appropriately, such as when capacity is 0 or when weights and values arrays are empty

- Correctly throws an error if the length of the `weights` and `values` arrays are not equal
- Use camelCase consistently through the codebase
- Add type annotations to the function params and return types
- Adding comments within the loops to clarify the logic
- Ensure the function handles edge cases appropriately, such as when capacity is 0 or when weights and values arrays are empty
Copy link
Contributor

@appgurueu appgurueu left a comment

Choose a reason for hiding this comment

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

Thanks for the refactor

@raklaptudirm raklaptudirm merged commit b4062be into TheAlgorithms:master Apr 8, 2024
@sozelfist sozelfist deleted the ref/dp/0-1-knapsack branch April 8, 2024 12:01
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