|All-time Popular Problems|
|Maximum difference between node and its ancestor|
|Right View of Binary Tree|
|Delete without head pointer|
|Find the number of islands|
|Delete nodes having greater value on right|
|Reverse Level Order Traversal|
|Binary Tree to DLL|
|Find all pairs with a given sum|
|n'th node from end of linked list|
|Equal to product|
Given pointer to the head node of a linked list, the task is to reverse the linked list.
You need to complete a method reverse() that takes head as argument and returns new head.
There are multiple test cases. For each test case, this method will be called individually. The first line of input contains number of test cases. Every test case has two lines, number of nodes first line and data values in next line.
Reverse the linked list and return head of the modified list.
1 2 3 4 5 6
6 5 4 3 2 1