Skip to content

Conversation

Be1chenok
Copy link

Challenge 22 Solution

Submitted by: @Be1chenok
Challenge: Challenge 22

Description

This PR contains my solution for Challenge 22.

Changes

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

Testing

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

Thank you for reviewing my submission! 🚀

Copy link

coderabbitai bot commented Oct 12, 2025

Walkthrough

Adds a new Go program with greedy coin-change logic, exposing MinCoins and CoinCombination functions, plus a main function demonstrating usage with sample denominations and amounts.

Changes

Cohort / File(s) Summary
Greedy coin change implementation
challenge-22/submissions/Be1chenok/solution-template.go
Introduces MinCoins(amount, denominations) and CoinCombination(amount, denominations) implementing a greedy coin-change approach; adds a main function demonstrating outputs for sample inputs.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant main as main()
  participant GC as GreedyChange
  participant Out as Console

  User->>main: Run program
  main->>GC: MinCoins(amount, denominations)
  GC-->>main: minCoinCount or -1
  main->>GC: CoinCombination(amount, denominations)
  GC-->>main: map[denomination]count
  main->>Out: Print results per amount
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

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 succinctly summarizes the primary change by indicating that a solution for Challenge 22 has been added and references the relevant author, making it clear and specific enough for a reviewer scanning the history.
Description Check ✅ Passed The description clearly outlines the challenge context, the added solution file location, and test status, directly relating to the changeset without containing any off-topic content.

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

@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 (1)
challenge-22/submissions/Be1chenok/solution-template.go (1)

36-36: Run gofmt for consistent formatting.

The code has inconsistent spacing (e.g., for i:=len(denominations)-1;i>=0;i--{ should have spaces around operators). Additionally, consider renaming cntNums to something more descriptive like coinCounts.

Run the following command to format the code:

#!/bin/bash
# Format the Go code
gofmt -w challenge-22/submissions/Be1chenok/solution-template.go

Also applies to: 54-54

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a2868df and 8b8bd34.

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

7-27: LGTM!

The demonstration code is clear and appropriately exercises both functions with standard US denominations.

@Be1chenok Be1chenok marked this pull request as draft October 12, 2025 20:34
@Be1chenok Be1chenok marked this pull request as ready for review October 12, 2025 20:35
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