Commented
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```python3 []\nclass Solution:\n    def maxNonDecreasingLength(self, nums1: List[int], nums2: List[int]) -> int:\n        # Min ans = 1, individual element subarray\n        # 2 options for idx, either use nums1 or nums2\n        # 2 options for prev, either nums1, nums2\n        # This can be covered with state (idx: int, prev: bool (1 | 0))\n        dp = [[1] * 2 for _ in range(len(nums1))]\n        for i in range(1, len(nums1)):\n            if nums1[i] >= nums1[i - 1]:\n                dp[i][0] = max(dp[i][0], 1 + dp[i - 1][0])\n            if nums1[i] >= nums2[i - 1]:\n                dp[i][0] = max(dp[i][0], 1 + dp[i - 1][1])\n            \n            if nums2[i] >= nums1[i - 1]:\n                dp[i][1] = max(dp[i][1], 1 + dp[i - 1][0])\n            if nums2[i] >= nums2[i - 1]:\n                dp[i][1] = max(dp[i][1], 1 + dp[i - 1][1])\n        return max([max(dp[i][0], dp[i][1]) for i in range(len(nums1))])\n# old -----------------------------------------------------------------------\n        for i in range(len(nums1) - 2, -1, -1):\n            # for nums1\n            dp[i][0] = 1\n            if nums1[i + 1] >= nums1[i]:\n                dp[i][0] = max(dp[i][0], 1 + dp[i + 1][0])\n            if nums2[i + 1] >= nums1[i]:\n                dp[i][0] = max(dp[i][0], 1 + dp[i + 1][1])\n            # for nums2\n            dp[i][1] = 1\n            if nums1[i + 1] >= nums2[i]:\n                dp[i][1] = max(dp[i][1], 1 + dp[i + 1][0])\n            if nums2[i + 1] >= nums2[i]:\n                dp[i][1] = max(dp[i][1], 1 + dp[i + 1][1])\n        ans = 1\n        for i in range(len(nums1)):\n            ans = max(ans, dp[i][0], dp[i][1])\n        return ans\n```
['Python3']