-
Notifications
You must be signed in to change notification settings - Fork 2
feat(algorithms, two-pointers, dynamic-programming): two-pointers dp and bs problems #154
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
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds three algorithm problem implementations (Decode Ways, Split Array Largest Sum, Count Pairs) with READMEs and tests, refactors an internal helper in two_sum_less_k and parameterizes related tests, tweaks one test import formatting, and updates DIRECTORY.md navigation entries. Changes
Sequence Diagram(s)(omitted — changes are algorithmic additions and small refactors without multi-component sequential flows requiring diagramming) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ 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. 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: 5
🤖 Fix all issues with AI agents
In `@algorithms/search/binary_search/split_array_largest_sum/__init__.py`:
- Around line 42-46: split_array_2 currently calls max(nums)/sum(nums) without
handling empty input; add the same empty-input guard used in split_array (check
for an empty nums at the top of split_array_2 before computing left/right) and
return the identical value that split_array returns for empty input so behavior
is consistent; insert this guard immediately before the lines that compute left,
right to prevent ValueError from max()/sum().
In `@algorithms/search/binary_search/split_array_largest_sum/README.md`:
- Line 1: The Markdown heading in README.md has incorrect spacing ("# Split
Array Largest Sum"); update the heading in the file so there is exactly one
space after the hash (e.g., "# Split Array Largest Sum") to satisfy MD019 and
correct the heading formatting.
- Around line 104-106: In the README under the "Space Complexity" heading
replace the incorrect phrase "The time complexity of this solution is O(1)
because only constant space is used." with a correctly worded sentence
referencing space (e.g., "The space complexity of this solution is O(1) because
only constant space is used.") so the label and description match; update the
"Space Complexity" section text accordingly.
In `@algorithms/two_pointers/count_pairs/README.md`:
- Around line 32-35: Update the wording in the README to consistently hyphenate
"two-pointer" wherever the phrase appears (e.g., change "two pointers" and "two
pointer approach" to "two-pointer" and "two-pointer approach") so the style is
uniform across the paragraph describing sorting and pointer initialization.
In `@DIRECTORY.md`:
- Around line 62-63: Indentation of the nested list entries under "Decodeways"
is incorrect for markdownlint MD007; locate the "Decodeways" heading and the
linked list item "[Test Num
Decodings](https://github.com/BrianLusina/PythonSnips/blob/master/algorithms/dynamic_programming/decodeways/test_num_decodings.py)"
and change their indentation to the expected 2-space nesting (align the bullet
and its child links with two spaces per nesting level) and apply the same fix to
the other occurrences mentioned (around the entries at the other reported
locations).
🧹 Nitpick comments (2)
algorithms/search/binary_search/split_array_largest_sum/test_split_array_largest_sum.py (1)
9-15: Drop duplicated test cases to reduce noise.
These entries repeat and don’t add coverage.♻️ Suggested cleanup
SPLIT_ARRAY_LARGEST_SUM_TEST_CASES = [ ([1, 2, 3, 4, 5], 3, 6), ([1, 2, 3, 4, 5], 2, 9), ([5, 8, 2, 8, 3, 1], 1, 27), - ([1, 2, 3, 4, 5], 3, 6), - ([5, 8, 2, 8, 3, 1], 1, 27), ([3, 4, 5, 4, 2], 4, 6),algorithms/dynamic_programming/decodeways/test_num_decodings.py (1)
5-17: Remove duplicate test case; consider adding empty-string coverage.Line 7 and Line 11 repeat
("12", 2), which is redundant. You could replace the duplicate with an empty-string case to cover thenot sbranch.♻️ Suggested tweak
NUM_DECODINGS_TEST_CASES = [ ("11106", 2), ("12", 2), ("226", 3), ("06", 0), ("101", 1), - ("12", 2), + ("", 0), ("012", 0), ("0", 0), ("30", 0), ("10", 1), ("27", 1), ]
algorithms/search/binary_search/split_array_largest_sum/README.md
Outdated
Show resolved
Hide resolved
algorithms/search/binary_search/split_array_largest_sum/README.md
Outdated
Show resolved
Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
44f0e0b to
68db8ae
Compare
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: 1
🤖 Fix all issues with AI agents
In `@algorithms/search/binary_search/split_array_largest_sum/README.md`:
- Line 100: Fix the missing space in the inline code phrase by changing
"`max(nums)`to `sum(nums)`" to "`max(nums)` to `sum(nums)`" in the README text
so there's a space between the closing backtick of `max(nums)` and the word
"to".
algorithms/search/binary_search/split_array_largest_sum/README.md
Outdated
Show resolved
Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Describe your change:
Adds the following algorithms:
Modified some test cases as well
Checklist:
Fixes: #{$ISSUE_NO}.Summary by CodeRabbit
New Features
Documentation
Tests
Refactor
Chores
✏️ Tip: You can customize this high-level summary in your review settings.