category-wise-problems

contains category wise problems(data structures, competitive) of popular platforms.

View the Project on GitHub mayankdutta/category-wise-problems

563. Binary Tree Tilt, kind of DFS

Code ```cpp class Solution { public: int ans = 0; int dfs(TreeNode* root) { int left = root -> left ? dfs(root -> left) : 0; int right = root -> right ? dfs(root -> right) : 0; ans += abs(left - right); return abs(left - right) + root -> val; } int findTilt(TreeNode* root) { int something = dfs(root); return ans; } }; ```