Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE REQUEST] <Reverse Nodes in k-Group of LinkedList> #4723

Closed
Akshayp02 opened this issue Oct 8, 2023 · 3 comments
Closed

[FEATURE REQUEST] <Reverse Nodes in k-Group of LinkedList> #4723

Akshayp02 opened this issue Oct 8, 2023 · 3 comments

Comments

@Akshayp02
Copy link

What would you like to Propose?

The purpose of the "Reverse Nodes in k-Group of LinkedList" problem is to test your ability to manipulate linked lists algorithm design abilities, and problem-solving capabilities, making it a valuable exercise for honing your programming skills. and perform operations on them efficiently.

This problem serves several purposes:

  • Algorithmic Proficiency:
  • Problem-Solving Skills:
  • Efficiency:
  • Boundary Testing
  • Follow-up Challenge:

Issue details

Given the head of a linked list, you need to reverse the nodes of the list k at a time and return the modified list.
k is a positive integer and is less than or equal to the length of the linked list.
If the number of nodes is not a multiple of k, then the left-out nodes at the end should remain as they are.
You are allowed to change only the nodes themselves, not their values.

Example 1:

Input: head = [1,2,3,4,5], k = 2
Output: [2,1,4,3,5]
Example 2:

Input: head = [1,2,3,4,5], k = 3
Output: [3,2,1,4,5]

Constraints:

The number of nodes in the list is n.
1 <= k <= n <= 5000
0 <= Node.val <= 1000

Additional Information

you can solve the problem without using extra memory (i.e., without creating a new list) while still reversing the nodes in groups of k. Solving it in O(1) extra memory space typically requires manipulating the pointers within the existing linked list.

@shubhkapil
Copy link

Can I work on it.

@shubhkapil
Copy link

Can you please tell me how to contribute my code, and what files I have to include. I have forked and cloned the code in my system and I have worked on the Algorithm locally.

@Akshayp02
Copy link
Author

hey @shubhkapil i appreciate with your enthusiasm but I've already raise this issue so can you look more issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants