public Node firstCommonNode(Node a, Node b){ Node l1 = a; Node l2 = b; while(l1 != l2){ l1 = (l1 == null) ? b : l1.next; l2 = (l2 == null) ? a : l2.next; } return l1;}