Geady Rolling window c++ O(1) memory
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int maxNonDecreasingLength(vector<int>& nums1, vector<int>& nums2) {\n        int n = nums1.size();\n        int max_length = 1;\n        int l = 0, h = 1;\n        int last_max_start = -1;\n        int curr = min(nums2[0], nums1[0]);\n        while(h < n){\n            int next_min = nums1[h];\n            int next_max = nums2[h];\n            if(next_min > next_max) swap(next_min, next_max);\n            if(next_min >= curr){\n                last_max_start = -1;\n                max_length = max(max_length, h - l + 1);\n                curr = next_min;\n            } else if(next_max >= curr) {\n                if(last_max_start == -1)\n                    last_max_start = h;\n                curr = next_max;\n                max_length = max(max_length, h - l + 1);\n            } else if( l < last_max_start){\n                l = last_max_start;\n                curr = min(nums1[last_max_start], nums2[last_max_start]);\n                last_max_start = -1;\n                h = l + 1;\n                continue;\n            } else{\n                curr = next_min;\n                l = h;\n            }\n            ++h;\n        }\n\n        return max_length;\n\n\n        \n    }\n};\n```
['C++']