arnab2001 / DSA

Collection of DSA problems and solutions
38 stars 186 forks source link

code to reverse nodes in k groups #334

Closed joyeta148 closed 2 years ago

joyeta148 commented 2 years ago

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]