There is a separate linked list and the block size is set. For example, if my linked list is 1->2->3->4->5->6->7->8-NULL , and my block size is 4 , then cancel the first 4 elements and then 4 elements. The output of the problem should be 4->3->2->1->8->7->6->5-NULL
I was thinking about splitting the linked list into segments of size 4 , and then backwards. But in this way I have to use many additional nodes, which is undesirable at all. The complexity of the space should be minimized.
It will be very important if someone can find the best solution in which the use of additional nodes will be minimized.
source share