[c++] dp with constant space
The code itself is pretty self-explanatory\n\n    int maximumSum(vector<int>& arr) {\n        int size = arr.size();\n        if ( size == 1 ) return arr[ 0 ];\
The code itself is pretty self-explanatory\n```\n    int maximumSum(vector<int>& arr) {\n        int size = arr.size();\n        if ( size == 1 ) return arr[ 0 ];\n\n\t\t// dropped record the maximum sum ended at current index with one number being dropped\n        int dropped = max( arr[ 0 ], arr[ 1 ] );\n        // not dropped must take arr[ 1 ] at index = 1\n        int notDropped = max( arr[ 0 ] + arr[ 1 ], arr[ 1 ] );\n        int ans = max( dropped, notDropped );\n            \n        for ( int i = 2; i < size; i++ ) {\n            dropped = max( notDropped, arr[ i ] + dropped );\n            notDropped = max( notDropped + arr[ i ], arr[ i ] );\n            ans = max( ans, max( dropped, notDropped ) );\n        }\n        return ans;\n    }\n\t```
[]