Skip to content

Add solution for Challenge 22 by alimkinpark#1651

Open
alimkinpark wants to merge 1 commit into
RezaSi:mainfrom
alimkinpark:challenge-22-alimkinpark
Open

Add solution for Challenge 22 by alimkinpark#1651
alimkinpark wants to merge 1 commit into
RezaSi:mainfrom
alimkinpark:challenge-22-alimkinpark

Conversation

@alimkinpark

Copy link
Copy Markdown
Contributor

Challenge 22 Solution

Submitted by: @alimkinpark
Challenge: Challenge 22

Description

This PR contains my solution for Challenge 22.

Changes

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

Testing

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

Thank you for reviewing my submission! 🚀

@coderabbitai

coderabbitai Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Adds a complete Go solution for the coin-change problem using a greedy algorithm. Includes a main function that tests with U.S. coin denominations, and two exported functions: MinCoins (returns minimum coin count or -1) and CoinCombination (returns denomination→count map or empty map). Both iterate through denominations in descending order.

Changes

Coin-Change Solution

Layer / File(s) Summary
Test Setup & Main
challenge-22/submissions/alimkinpark/solution-template.go (lines 7–27)
main() defines U.S. coin denominations and iterates over test amounts, calling and printing results from MinCoins and CoinCombination.
Greedy Algorithm Core
challenge-22/submissions/alimkinpark/solution-template.go (lines 29–72)
MinCoins and CoinCombination both use descending greedy iteration to compute minimum coins and denomination breakdown; return -1 or empty map when exact change cannot be made.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 Coins in the greedy light,
Descending denominations dance just right,
From dollars down to pennies small,
Greedy hops make fewest calls,
A hopping solution for change of all! 🪙

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add solution for Challenge 22 by alimkinpark' is clear, concise, and directly describes the main change: adding a challenge solution submission.
Description check ✅ Passed The description is well-structured and directly related to the changeset, explaining that it contains a Challenge 22 solution with details on the file location and testing status.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.11.4)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
challenge-22/submissions/alimkinpark/solution-template.go (1)

32-32: 💤 Low value

Remove leftover TODO stubs.

Both // TODO: Implement this function comments are template artifacts — the functions are fully implemented.

🧹 Proposed cleanup
 func MinCoins(amount int, denominations []int) int {
-	// TODO: Implement this function
 	count := 0
 func CoinCombination(amount int, denominations []int) map[int]int {
-	// TODO: Implement this function
 	result := make(map[int]int)

Also applies to: 54-54


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4f8c352e-b5f6-4930-92ae-a503e8b89356

📥 Commits

Reviewing files that changed from the base of the PR and between ddab5b7 and 7c7d5b4.

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

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