Easy Recursive Approach Tackling Modes | ☑️☑️☑️☑️
Intuition\n\n\n\nUsing Two Helping fucntion one for traversing each node and another for traversing the subtree of each node.\n\n# Approach\nHere Using array in
# Intuition\n![team-7-naruto-4aiwy95pr1iettmo.jpg](https://assets.leetcode.com/users/images/516f2fe0-bc4a-46ac-a74d-464ce30d9f14_1698955940.0913227.jpeg)\n\n\n*Using Two Helping fucntion one for traversing each node and another for traversing the subtree of each node.*\n\n# Approach\nHere Using array instead of integers because they remain instinct \n\n# Complexity\n- Time complexity:\n**O(N)**\n\n- Space complexity:\n**O(N)**\n\n# Code\n```\nclass Solution {\n    public int averageOfSubtree(TreeNode root) {\nint count[]={0};\n        fn1(root,count);\n        return count[0];\n    }\n    public static void fn1(TreeNode root,int count[]){\n    int Arr[]={0,0};\nif(root==null )\nreturn ;\n        fn2(root,Arr);\n        if((Arr[1]!=0)&&(Arr[0]/Arr[1]==root.val))\n        count[0]++;\n        fn1(root.left,count);\n        fn1(root.right,count);\n    }\n     public static void fn2(TreeNode root,int Arr[]){\n         if(root==null)\n         return ;\n         Arr[0]=Arr[0]+root.val;\n         Arr[1]++;\n         \n         fn2(root.left,Arr);\n         fn2(root.right,Arr); \n    }\n}\n\n```
['Binary Search Tree', 'Recursion', 'Java']