Linked list k-append

QUESTION:

Append the last K elements of a linked list to the front.K can be greater than N.

Input Format:

Enter the size N, N space separated elements and number of elements that are to be appended(n).

How can K be greater than N? What is its logical significance? How to implement/include that case?

MY CODE: Click Here

Basically appending last n elements would mean the same list only. similarly appending any multiples of n last elements would lead to same list only. So instead of k just use k%n.

1 Like