-
-
Notifications
You must be signed in to change notification settings - Fork 100
283.MoveZeroes.cpp #186
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?
283.MoveZeroes.cpp #186
Conversation
Implement the solution for LeetCode problem 283, which moves all zeroes in the array to the end while maintaining the order of non-zero elements.
Reviewer's GuideIntroduces a C++ in-place two-pointer solution for moving zeroes to the end of an array and includes a simple test harness to verify correctness. Class diagram for Solution and helper functions (LeetCode 283)classDiagram
class Solution {
+void moveZeroes(vector<int>& nums)
}
class printVector {
+void printVector(const vector<int>& nums)
}
class main {
+int main()
}
Solution <.. main : uses
printVector <.. main : uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Thanks for raising the PR, the owner will be review it soon' keep patience, keep contributing>>>!!! make sure you have star ⭐ the repo
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.
Hey there - I've reviewed your changes - here's some feedback:
- Rename the file to match the project’s naming convention (e.g., "283.MoveZeroes.cpp") instead of "leetcode_283MoveZeroes.cpp".
- Use size_t for loop indices (e.g.,
for (size_t i = 0; i < nums.size(); ++i)) to avoid signed/unsigned comparisons. - Add more edge-case tests in the main function (empty array, all zeros, all non-zeros) to validate behavior across inputs.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Rename the file to match the project’s naming convention (e.g., "283.MoveZeroes.cpp") instead of "leetcode_283MoveZeroes.cpp".
- Use size_t for loop indices (e.g., `for (size_t i = 0; i < nums.size(); ++i)`) to avoid signed/unsigned comparisons.
- Add more edge-case tests in the main function (empty array, all zeros, all non-zeros) to validate behavior across inputs.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Updated indexing to use size_t for better compatibility with vector sizes and added edge case tests for the moveZeroes function.
mitulvaniya
left a 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.
i fixed the issue check
|
please merged this pr |
which Issue ??? |
|
Hey, @mitulvaniya14
|
Implement the solution for LeetCode problem 283, which moves all zeroes in the array to the end while maintaining the order of non-zero elements.
PR Title Format: Problem no.Problem name.cpp
Intuition
Approach
Code Solution (C++)
// Your code goes hereRelated Issues
By submitting this PR, I confirm that:
Summary by Sourcery
Provide a C++ implementation for LeetCode 283: Move Zeroes with an in-place two-pointer approach, including a vector-print helper and example usage in main.
New Features: