To avoid using global variable, you can take use of size-1 array or any other objects.

```
public int findTilt(TreeNode root) {
int[] ret = new int[1];
helper(root, ret);
return ret[0];
}
private int helper(TreeNode node, int[] ret){
if(node == null){
return 0;
}
int l_sum = helper(node.left, ret);
int r_sum = helper(node.right, ret);
ret[0] += Math.abs(l_sum - r_sum);
return l_sum + r_sum + node.val
}
```