# Binary Tree Tilt (Leetcode 563)

Problem Link: <https://leetcode.com/problems/binary-tree-tilt/>

```python
class Solution:

    def findTilt(self, root: Optional[TreeNode]) -> int:
        
        global tilt
        tilt=0
        
        def summ(root):
            global tilt    
            if(root is None):
                return 0
            lsum=summ(root.left)
            rsum=summ(root.right)
            tilt=tilt+abs(lsum-rsum)
            return lsum+rsum+root.val
        
        summ(root)
        return tilt
```
