Reverse a linked list and Find common ancestor