-
-
Notifications
You must be signed in to change notification settings - Fork 785
feat(challenge-2): implement ReverseString solution #857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughTwo new Go solution files are added to the interview practice repository: one implementing a sum function for challenge-1 that reads and adds two comma-separated integers, and another implementing a string reversal function for challenge-2 that reverses input strings using rune-based manipulation. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Both solutions are straightforward implementations with minimal logic density. Review focuses on verifying correct I/O handling, basic algorithm correctness (addition and rune-based reversal), and adherence to the solution template structure. Possibly related PRs
Pre-merge checks❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
challenge-1/submissions/brenoamin/solution-template.go (1)
7-19: Input format is tightly coupled to%d, %dpatternThe
fmt.Scanf("%d, %d", &a, &b)call expects a literal comma and (due to the space) typically an input like1, 2. If the challenge harness or manual testing might provide1,2or1 2, this will fail parsing. Consider whether you want a more permissive format string (e.g., whitespace‑separated) or to clearly document that the expected input is"<int>, <space><int>".challenge-2/submissions/brenoamin/solution-template.go (1)
9-21: Optional: surface scanner errors for robustnessFor the challenge this is fine, but if you want slightly more robust behavior, you could check
scanner.Err()whenScan()returns false and decide whether to log/exit vs. just doing nothing.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
challenge-1/submissions/brenoamin/solution-template.go(1 hunks)challenge-2/submissions/brenoamin/solution-template.go(1 hunks)
🔇 Additional comments (2)
challenge-1/submissions/brenoamin/solution-template.go (1)
21-23: Sum helper is clear and correct
Sum(a, b)is trivial, side‑effect free, and matches the challenge intent; no issues here.challenge-2/submissions/brenoamin/solution-template.go (1)
23-29: Unicode‑aware reversal is implemented correctlyThe rune slice + two‑pointer swap loop correctly reverses by Unicode code point and has clean O(n) behavior. This is exactly what you want for this challenge.
Challenge 2 — Reverse a String
This pull request includes the implementation for challenge-2.
✔ What’s included
ReverseStringfunction using a rune-based two-pointer technique🧪 Testing
Run the tests from the
challenge-2/directory:go test -v