```
class Solution {
int sum = 0;
public int findTilt(TreeNode root) {
searchSum(root);
return sum;
}
public int searchSum(TreeNode root){
if(root == null)
return 0;
int left = searchSum(root.left);
int right = searchSum(root.right);
sum += Math.abs(left-right);
return left + right + root.val;
}
}
```