
The first and only line contains the 'N' sized linked list elements separated by space and terminated by -1.
The only line of output prints the updated linked list elements separated by a single space.
You do not need to print anything, it has already been taken care of. Just implement the given function and return the answer.
-10^9 <= 'data' <= 10^9
Time Limit: 1 sec
Try to traverse with updating the position of the current node from the head and if the position is in integral powers of 2 (use previous power of 2), then just skip that node and make a new link form the previous node to the next of the current node. Always irrespective of the size of the linked list you need to skip the head in the updated linked list.