```
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param {TreeNode} root
# @return {string[]}
def binaryTreePaths(self, root):
if root==None:
return []
if root.left==None and root.right==None:
return [str(root.val)]
res=self.binaryTreePaths(root.left)+self.binaryTreePaths(root.right)
return [str(root.val)+'->'+i for i in res]
```