C++ Easy Understandable Code
Its pretty easy question... we have to make an array to store the sum of nodes at all distinct level..then  we traverse from from level 1 to depth of our tree i
Its pretty easy question... we have to make an array to store the sum of nodes at all distinct level..then  we traverse from from level 1 to depth of our tree in our array and boom we got our answer :D :D\n```\nclass Solution {\npublic:\n    int depth(TreeNode* root)\n    {\n        if(root==NULL)\n            return 0;\n        return 1+max(depth(root->left),depth(root->right));\n    }\n    int arr[10001];\n    void dfs(TreeNode* root,int idx)\n    { \n        if(root==NULL)\n            return;\n        arr[idx]+=root->val;\n        dfs(root->left,idx+1);\n        dfs(root->right,idx+1);\n        \n    }\n    int maxLevelSum(TreeNode* root) {\n        dfs(root,1);\n        int mx=-1e5;\n        int idx=0;\n        int ji=depth(root);\n        for(int i=1;i<=ji;i++)\n        {\n            if(arr[i]>mx)\n            {\n                idx=i;\n                mx=arr[i];\n            }\n        }\n        return idx;\n        \n        \n    }\n}; \n\n```
[]