Skip to content

linked-list-1#1776

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

linked-list-1#1776
shinjaneegupta wants to merge 1 commit intosuper30admin:masterfrom
shinjaneegupta:master

Conversation

@shinjaneegupta
Copy link
Copy Markdown

No description provided.

@super30admin
Copy link
Copy Markdown
Owner

Your solution for reversing a linked list is excellent. It correctly implements the iterative approach with O(n) time and O(1) space complexity. The code is clean and easy to understand.

One minor note: in the ReverseLinkedList.py file, the comments at the top (about LinkedListCycle2) seem to be misplaced. Make sure that each file contains comments relevant to the code in that file. For ReverseLinkedList, you might want to add a comment explaining the iterative reversal approach, but it's not strictly necessary since the code is straightforward.

Also, in the ReverseLinkedList solution, you have a check for if head is None: return None. This is correct, but note that the reference solution does not explicitly check for this because the while loop condition (curr != null) naturally handles the empty list. Your approach is equally valid.

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