Skip to content

[IMP] Two-Pointer-2#1768

Open
amitmittal117 wants to merge 1 commit intosuper30admin:masterfrom
amitmittal117:master
Open

[IMP] Two-Pointer-2#1768
amitmittal117 wants to merge 1 commit intosuper30admin:masterfrom
amitmittal117:master

Conversation

@amitmittal117
Copy link

No description provided.

@super30admin
Copy link
Owner

Your solution for the "Merging of 2 arrays" problem is excellent. It correctly implements the optimal algorithm with O(m+n) time and O(1) space. The code is clean and easy to understand.

However, note that the problem requires you to merge into nums1, and your solution does that correctly. You have also correctly handled the edge cases (like when n=0 or m=0) because the while loops conditionally check the pointers.

One small suggestion: you might consider adding a comment to explain why you don't need to handle remaining elements in nums1 (because they are already in the correct position). This can make the code even more understandable to others.

Also, please be cautious when submitting multiple files. The problem specifically asks for the solution to the "Merging of 2 arrays" problem, so you should ensure that your submission only includes the relevant code. The other two solutions are for different problems and should not be included in the same file unless specified.

Overall, great job!

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.

2 participants