Solutions to rotating a linked list by n times and finding all the permutation of an array of integers