Skip to content

Comments

[removeDuplicates, merge 2 sorted arrays, searchMatrix]#1775

Open
takchiks wants to merge 2 commits intosuper30admin:masterfrom
takchiks:master
Open

[removeDuplicates, merge 2 sorted arrays, searchMatrix]#1775
takchiks wants to merge 2 commits intosuper30admin:masterfrom
takchiks:master

Conversation

@takchiks
Copy link

No description provided.

@super30admin
Copy link
Owner

Your solution for the merge function is excellent. It correctly implements the algorithm with optimal time and space complexity. The code is clean and easy to understand. However, note that the problem requires only the merge function to be implemented. Including other functions (like removeDuplicates and searchMatrix) in the same file might be confusing if this is intended for a submission to a platform that expects only the solution for the specific problem. In the future, ensure that you only submit the relevant function or class as required by the problem.

One minor improvement: You can make the code slightly more readable by using explicit if-else statements instead of the ternary operator, but this is a matter of preference. The ternary operator is concise and acceptable.

Also, note that in the merge function, you decrement l, m, and n within the ternary operator. This is correct, but be cautious as it can be error-prone if not handled carefully.

Overall, great job on the merge function!

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