✅✅ Bottom-Up Dynamic Programming C++ Solution 🔥🔥
Code
# Code
```cpp []
class Solution {
private:
    vector<vector<int>>dp;

public:
    int maxNonDecreasingLength(vector<int>& nums1, vector<int>& nums2) {
        int n = nums1.size();
        int maxLength = 1;

        // every element in nums1 and nums2 form a NDS
        // by itself when chosen so initialise to 1
        dp = vector<vector<int>>(n, vector<int>(2, 1));
        for (int i = 1; i < n; i++){
            // update dp[i][0]
            if (nums1[i]>=nums1[i-1]) dp[i][0] = dp[i-1][0]+1;
            if (nums1[i]>=nums2[i-1]) dp[i][0] = max(dp[i][0], dp[i-1][1]+1);
            // update dp[i][1]
            if (nums2[i]>=nums2[i-1]) dp[i][1] = dp[i-1][1]+1;
            if (nums2[i]>=nums1[i-1]) dp[i][1] = max(dp[i][1], dp[i-1][0]+1);
            // Update the maximum length
            maxLength = max(maxLength, max(dp[i][0], dp[i][1]));
        }
        return maxLength;
    }
};
```
['C++']