Easy C++ DP Botton Up Solution 
Complexity
Time complexity: O(n)
Space complexity: O(n)
Code
# Complexity\n- Time complexity: $$O(n)$$\n- Space complexity: $$O(n)$$\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int maxNonDecreasingLength(vector<int>& nums1, vector<int>& nums2) {\n        int n = nums1.size(), ans = 1, last = 0, next, temp = 0;\n        vector<vector<int>> dp(2, vector<int>(n));\n        dp[0][n - 1] = dp[1][n - 1] = 1;\n        for(int i = n - 2 ; i >= 0 ; i--) {\n            dp[0][i] = dp[1][i] = 1;\n            if(nums1[i] <= nums1[i + 1]) {\n                dp[0][i] = max(dp[0][i], 1 + dp[0][i + 1]);\n            }\n            if(nums1[i] <= nums2[i + 1]) {\n                dp[0][i] = max(dp[0][i], 1 + dp[1][i + 1]);\n            }\n            if(nums2[i] <= nums1[i + 1]) {\n                dp[1][i] = max(dp[1][i], 1 + dp[0][i + 1]);\n            }\n            if(nums2[i] <= nums2[i + 1]) {\n                dp[1][i] = max(dp[1][i], 1 + dp[1][i + 1]);\n            }\n            ans = max(ans, max(dp[0][i], dp[1][i]));\n        }\n        return ans;\n    }\n};\n\n// Time complexity: O(n)\n// Space complexity: O(n)\n```
['C++']