+ 3

How to right rotate a linked list in java?

input-1 2 3 4 2 output -3 4 1 2 input-1 2 3 4 3 output-2 3 4 1

30th Jan 2018, 5:11 AM
Nikhil Kohli
Nikhil Kohli - avatar
2 Answers
+ 13
1 2 3 4 3 no. of elements of linked list is n=4 & b=3 , take out b elements from (n-b)th posn & then take out (n-b) elements from the starting
30th Jan 2018, 5:28 AM
Gaurav Agrawal
Gaurav Agrawal - avatar