Skip to content

Solved Linked-List 1#1775

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

Solved Linked-List 1#1775
pratul2789 wants to merge 1 commit intosuper30admin:masterfrom
pratul2789:master

Conversation

@pratul2789
Copy link
Copy Markdown

No description provided.

@super30admin
Copy link
Copy Markdown
Owner

Your solution for reversing the linked list is excellent. You have implemented both the iterative and recursive approaches, though you have chosen to submit the iterative one. The iterative solution is efficient and follows the best practices. The code is clean and well-commented.

Strengths:

  • You have provided both iterative and recursive solutions, showing a good understanding of the problem.
  • The iterative solution uses constant space and linear time, which is optimal.
  • The code is readable with meaningful variable names and comments.

Areas for improvement:

  • Although you have provided solutions for multiple problems, when submitting for a specific problem, it's best to focus only on that problem. The other problems (like cycle detection and removing nth node) are not relevant here.
  • In the recursive solution, you have a comment that says "TC: O(n), SC: O(n)", which is correct due to the recursion stack. However, the recursive solution is not active. It's good to note that the recursive solution might not be as efficient in terms of space.

Overall, your solution for reversing the linked list is correct and efficient.

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