Skip to content

Conversation

@n0l3r
Copy link

@n0l3r n0l3r commented Dec 23, 2025

Challenge 22 Solution

Submitted by: @n0l3r
Challenge: Challenge 22

Description

This PR contains my solution for Challenge 22.

Changes

  • Added solution file to challenge-22/submissions/n0l3r/solution-template.go

Testing

  • Solution passes all test cases
  • Code follows Go best practices

Thank you for reviewing my submission! 🚀

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 23, 2025

Warning

Rate limit exceeded

@n0l3r has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 9 minutes and 29 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 5727cc6 and ce9116a.

📒 Files selected for processing (1)
  • challenge-22/submissions/n0l3r/solution-template.go

Walkthrough

A new Go solution file is added implementing a greedy coin-change algorithm with two exported functions: MinCoins computes the minimum coin count for a given amount, and CoinCombination returns a map of denomination-to-count pairs. A main function demonstrates usage with US coin denominations.

Changes

Cohort / File(s) Summary
Coin-change greedy algorithm
challenge-22/submissions/n0l3r/solution-template.go
New file with MinCoins(amount int, denominations []int) int and CoinCombination(amount int, denominations []int) map[int]int functions implementing greedy coin selection. Includes main function demonstrating usage with US denominations [1, 5, 10, 25, 50] and various test amounts. Returns -1 if amount cannot be formed.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Pre-merge checks

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a solution for Challenge 22 submitted by n0l3r, which matches the changeset.
Description check ✅ Passed The description is clearly related to the changeset, providing context about the Challenge 22 solution submission and the file added.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (3)
challenge-22/submissions/n0l3r/solution-template.go (3)

31-52: Document that greedy approach doesn't always produce minimum coins.

The greedy algorithm works for US coin denominations but doesn't guarantee the minimum number of coins for arbitrary denominations. For example, with denominations [1, 3, 4] and amount 6, greedy yields 3 coins (4+1+1) while optimal is 2 coins (3+3). Consider adding a comment noting this limitation.


32-51: Inconsistent indentation detected.

Lines 33, 39, 42-44, and 48 use spaces instead of tabs, which is inconsistent with Go conventions. Run go fmt to normalize indentation.


59-68: Inconsistent indentation detected.

Lines 61-62 and 65-67 use spaces instead of tabs. Run go fmt to normalize indentation.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 669bf54 and 5727cc6.

📒 Files selected for processing (1)
  • challenge-22/submissions/n0l3r/solution-template.go
🔇 Additional comments (1)
challenge-22/submissions/n0l3r/solution-template.go (1)

7-27: LGTM! Clear demonstration of the solution.

The main function provides a good demonstration with multiple test cases using standard US coin denominations.

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.

1 participant