Java DP Solution
\n\n# Code\njava []\nclass Solution {\n    public static int[][] DP;\n\n    public int maxNonDecreasingLength(int[] nums1, int[] nums2) {\n        DP = new int[
\n\n# Code\n```java []\nclass Solution {\n    public static int[][] DP;\n\n    public int maxNonDecreasingLength(int[] nums1, int[] nums2) {\n        DP = new int[nums1.length][2];\n        DP[0][0] = 1;\n        DP[0][1] = 1;\n        int a,b;\n        int max1 = 1,max2 = 1;\n        for(int i = 1;i < nums1.length;i++) {\n            a = nums1[i] >= nums1[i - 1]?DP[i - 1][0] + 1:1;\n            b = nums1[i] >= nums2[i - 1]?DP[i - 1][1] + 1:1;\n            DP[i][0] = Math.max(a,b);\n            if(DP[i][0] > max1) max1 = DP[i][0];\n            a = nums2[i] >= nums2[i - 1]?DP[i - 1][1] + 1:1;\n            b = nums2[i] >= nums1[i - 1]?DP[i - 1][0] + 1:1;\n            DP[i][1] = Math.max(a,b);\n            if(DP[i][1] > max2) max2 = DP[i][1];\n        }\n\n        return Math.max(max1,max2);   \n    }\n}\n```
['Java']