Redirecting to
NADOS

Reverse Node Of Linkedlist In K Group

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

1. Given a singly linklist, reverse the nodes of a linked list k at a time and return its modified linkedlist.
2. If number of nodes in multiple of k then it will reverse otherwise it will add inn the end of linkedlist without any change.
Input Format
1->5->2->9->5->14->11->1->10->10->1->3->null
7
Output Format
11->14->5->9->2->5->1->10->10->1->3->null
Question Video
Constraints
1 <= size Of LinkedList <= 10^6
0 <= k <= 10^6
Sample Input
12
1 5 2 9 5 14 11 1 10 10 1 3
7
Sample Output
11 14 5 9 2 5 1 1 10 10 1 3 


  • Asked in Companies
  • Related Topics






Video Solution

Code Solution

Run
 
Run
Id Name