Python (Simple DP)
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:\n    def maxNonDecreasingLength(self, nums1, nums2):\n        n = len(nums1)\n\n        @lru_cache(None)\n        def dfs(i):\n            if i == n:\n                return 0,0 \n\n            mx_1, mx_2 = 1, 1 \n\n            if i+1 < n and nums1[i+1] >= nums1[i]:\n                mx_1 = max(mx_1,1+dfs(i+1)[0])\n\n            if i+1 < n and nums2[i+1] >= nums2[i]:\n                mx_2 = max(mx_2,1+dfs(i+1)[1])\n\n            if i+1 < n and nums1[i+1] >= nums2[i]:\n                mx_2 = max(mx_2,1+dfs(i+1)[0])\n\n            if i+1 < n and nums2[i+1] >= nums1[i]:\n                mx_1 = max(mx_1,1+dfs(i+1)[1])\n\n            return mx_1,mx_2\n\n        return max(max([dfs(i)[0] for i in range(n)]),max([dfs(i)[1] for i in range(n)]))\n```
['Python3']