[Idea]: Swapping Node in a Linked List at kth node #1838
Labels
enhancement
New feature or request
gssoc-ext
Contributions made as part of GirlScript Summer of Code Extended Edition.
level1
GirlScript Summer of Code | Contributor's Levels
Idea Title
Swapping Node in a Linked List at kth node
Idea Description
We are given the head of a linked list, and an integer k.
Return the head of the linked list after swapping the values of the kth node from the beginning and the kth node from the end (the list is 1-indexed).
Input: head =
[1,2,3,4,5]
, k =2
Output:
[1,4,3,2,5]
Potential Benefits
Implementation Suggestions (Optional)
No response
The text was updated successfully, but these errors were encountered: