Skip to content

Implemented the Coin Change algorithm in R.#170

Merged
siriak merged 3 commits into
TheAlgorithms:masterfrom
Sachinn-64:feat-coin-change-ultra-clean
Oct 11, 2025
Merged

Implemented the Coin Change algorithm in R.#170
siriak merged 3 commits into
TheAlgorithms:masterfrom
Sachinn-64:feat-coin-change-ultra-clean

Conversation

@Sachinn-64
Copy link
Copy Markdown
Contributor

  • Finds the minimum number of coins needed to make a target amount. Uses dynamic programming with both top-down and bottom-up approaches. Handles edge cases including impossible amounts and zero target. Prints DP table, coin combinations, and optimal solutions. Time Complexity: O(amount * num_coins).
  • Space Complexity: O(amount) for DP array.

Finds the minimum number of coins needed to make a target amount.
Uses dynamic programming with both top-down and bottom-up approaches.
Handles edge cases including impossible amounts and zero target.
Prints DP table, coin combinations, and optimal solutions.
Time Complexity: O(amount * num_coins).
Space Complexity: O(amount) for DP array.
@Sachinn-64 Sachinn-64 requested a review from siriak as a code owner October 8, 2025 21:57
Copilot AI review requested due to automatic review settings October 8, 2025 21:57
@Sachinn-64 Sachinn-64 requested a review from acylam as a code owner October 8, 2025 21:57
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements the classic Coin Change algorithm in R using dynamic programming to find the minimum number of coins needed to make a target amount. The implementation includes comprehensive documentation, edge case handling, and example test cases.

  • Implements dynamic programming solution with O(amount * num_coins) time complexity
  • Includes helper function for visualizing the DP table for educational purposes
  • Provides three test cases covering basic usage, impossible amounts, and larger datasets

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread dynamic_programming/coin_change.r Outdated
Comment thread dynamic_programming/coin_change.r
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings October 8, 2025 22:01
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread dynamic_programming/coin_change.r
Comment thread dynamic_programming/coin_change.r
@Sachinn-64
Copy link
Copy Markdown
Contributor Author

@siriak

Copy link
Copy Markdown
Member

@siriak siriak left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@siriak siriak merged commit b397c7d into TheAlgorithms:master Oct 11, 2025
2 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.

3 participants