C++|Stack solution
Please upvote if this will help you!!\uD83D\uDE0A\n\n\nclass Solution {\npublic:\n    int maxChunksToSorted(vector<int>& arr) {\n        stack<int>st;\n      \n
Please upvote if this will help you!!\uD83D\uDE0A\n\n```\nclass Solution {\npublic:\n    int maxChunksToSorted(vector<int>& arr) {\n        stack<int>st;\n      \n      for(int i=0;i<arr.size();i++){\n         int num = arr[i];\n        while(!st.empty()&& st.top()>arr[i]){\n          num = max(num,st.top());\n          st.pop();\n        }\n        st.push(num);\n      }\n      return st.size();\n    }\n};\n```
['Stack', 'C', 'Monotonic Stack', 'C++']