Here is my python code.

```
def flatten(self, root):
"""
:type root: TreeNode
:rtype: void Do not return anything, modify root in-place instead.
"""
tmp, rightMost = root, root
while(tmp != None):
if(tmp.left != None):
while(rightMost != None and rightMost.right != None):
rightMost = rightMost.right
rightMost.right = tmp.left
tmp.left = None
tmp = tmp.right
```

I think the answer is not unique, it just requires to convert a tree to a link list.

If the tree is like 2<-1->3, (2,3 is the left and right child of 1 respectively),

my program get 1->3->2, but OJ tells me that it is wrong and the correct answer is 1->2->3.

I do not understand.

Can anyone tell me why?

Thanks