Skip to content

Comments

completed#1772

Open
sejalrj wants to merge 3 commits intosuper30admin:masterfrom
sejalrj:master
Open

completed#1772
sejalrj wants to merge 3 commits intosuper30admin:masterfrom
sejalrj:master

Conversation

@sejalrj
Copy link

@sejalrj sejalrj commented Feb 21, 2026

No description provided.

@super30admin
Copy link
Owner

Strengths:

  • You have implemented the correct algorithm for merging two sorted arrays in-place.
  • The time and space complexity are optimal.
  • You correctly handle the case where there are remaining elements in nums2 by copying them over.

Areas for improvement:

  • Variable Naming: Use more descriptive variable names. For example, instead of f and s, use p1 (pointer for nums1) and p2 (pointer for nums2). This makes the code easier to understand.
  • Remove Comments: The commented-out code (like the lines that handle remaining elements in nums1) should be removed because they are not needed and can clutter the code. Note that if there are remaining elements in nums1, they are already in the correct position, so no action is required.
  • Consistency: Ensure that the code is consistent in style. For instance, the indentation and spacing are mostly good, but there are minor inconsistencies (e.g., f-=1 should have a space: f -= 1).

Additional note: The solution for Problem1.py (search in a 2D matrix) and Problem3.py (remove duplicates from sorted array II) are not part of this problem. When submitting solutions, make sure each file corresponds to the correct problem.

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