Skip to content

Add solution for Challenge 6 by shansing#1434

Open
shansing wants to merge 5 commits intoRezaSi:mainfrom
shansing:challenge-6-shansing
Open

Add solution for Challenge 6 by shansing#1434
shansing wants to merge 5 commits intoRezaSi:mainfrom
shansing:challenge-6-shansing

Conversation

@shansing
Copy link
Contributor

Challenge 6 Solution

Submitted by: @shansing
Challenge: Challenge 6

Description

This PR contains my solution for Challenge 6.

Changes

  • Added solution file to challenge-6/submissions/shansing/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 Feb 26, 2026

Warning

Rate limit exceeded

@shansing has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 11 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 0b993d8 and f12b719.

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

Walkthrough

The PR introduces a new CountWordFrequency function in the challenge6 package that processes input text by extracting word-like tokens using regex, normalizing them to lowercase, removing apostrophes, and returning a frequency map.

Changes

Cohort / File(s) Summary
Word Frequency Counter
challenge-6/submissions/shansing/solution-template.go
Added new CountWordFrequency(text string) map[string]int function that tokenizes input text using regex, normalizes words to lowercase, strips apostrophes, and returns a map counting word occurrences.

Possibly related PRs

  • #1109: Adds identical CountWordFrequency function to package challenge6 with the same normalization and frequency-counting logic.
  • #1198: Implements the same CountWordFrequency function in challenge6 that tokenizes and counts word frequencies with similar text normalization.
  • #841: Adds an implementation of CountWordFrequency in challenge6 with regex-based tokenization and word-frequency counting logic.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A function hops into the fold,

Counting words both new and old,

Regex strips away the clutter bright,

Words lowercase, normalized just right! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a solution for Challenge 6 submitted by shansing, which aligns with the changeset.
Description check ✅ Passed The description is directly related to the changeset, explaining the Challenge 6 solution submission and clearly referencing the file added.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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


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: 1

🧹 Nitpick comments (1)
challenge-6/submissions/shansing/solution-template.go (1)

24-24: Consider compiling regex at package level for efficiency.

regexp.MustCompile is called on every function invocation. For a challenge solution this is fine, but in production code the compiled regex would typically be a package-level variable to avoid repeated compilation overhead.

♻️ Optional refactor
var wordRegex = regexp.MustCompile(`[\w']+`)

func CountWordFrequency(text string) map[string]int {
	countMap := make(map[string]int)
	words := wordRegex.FindAllString(text, -1)
	// ...
}

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a7ac764 and 0b993d8.

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

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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