165646729
求解思路:
采用递归,深度优先遍历,找到一个节点时,返回,逐层记录遍历方向,另一个节点
同,这样深度优先遍历后,可以找到这两个节点由根节点访问的路径,然后沿着这个
路径找到分叉的地方就行了
代码:

示例:
please input a,b:4 3
the common father node is:1

Move Zeroes

Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements. For exa...

阅读全文

Odd Even Linked List

Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not ...

阅读全文

Remove Duplicates from Sorted Array

Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space...

阅读全文