Using two DP array
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```csharp []\npublic class Solution {\n    public int MaxNonDecreasingLength(int[] nums1, int[] nums2) {\n        int n = nums1.Length;\n        int[] dp1 = new int[n];\n        int[] dp2 = new int[n];\n\n        for(int i=0; i<n; i++)\n        {\n            dp1[i] = 1;\n            dp2[i] = 1;\n        }\n        int max = 1;\n        for(int i=1; i<n; i++)\n        {\n           if (nums1[i] >= nums1[i-1])\n           {\n              dp1[i] = Math.Max(dp1[i], dp1[i-1]+1);\n           }\n           if (nums1[i] >= nums2[i-1])\n           {\n             dp1[i] = Math.Max(dp1[i], dp2[i-1]+1);\n           }\n           if (nums2[i] >= nums1[i-1])\n           {\n              dp2[i] = Math.Max(dp2[i], dp1[i-1]+1);\n           }\n           if (nums2[i] >= nums2[i-1])\n           {\n             dp2[i] = Math.Max(dp2[i], dp2[i-1]+1);\n           }\n           max = Math.Max(max, Math.Max(dp1[i], dp2[i]));\n        }\n        return max;\n    }\n}\n```
['C#']