```
private int tilt = 0;
private int sum(TreeNode root) {
if (root == null) return 0;
int l = sum(root.left), r = sum(root.right);
tilt += Math.abs(l - r);
return l+r+root.val;
}
public int findTilt(TreeNode root) {
sum(root);
return tilt;
}
```