Explained - Sliding window || Very simple and easy to understand solution
Try to take the minimum from both the array.\n2. If not possible to take min, then try to take max. But while taking max, lets store this index and we will rest
1. Try to take the minimum from both the array.\n2. If not possible to take min, then try to take max. But while taking max, lets store this index and we will restart from here when the increasing sequence breaks\n3. If its not poassilbe to take max as well then its the break of current sequence and reset pointer to previously stored one.\n4. While evaluating the nums3, keep traking the max non decreasing sequence length.\n\n# Code\n```\nint maxNonDecreasingLength(vector<int>& nums1, vector<int>& nums2) {\n    vector<int> nums3(nums1.size(), 0);\n    int last = 0, lastInd = -1, back = 0, ans = 1;\n    for(int i = 0; i < nums1.size(); ++i){\n        int mn = min(nums1[i], nums2[i]), mx = max(nums1[i], nums2[i]);\n        if(mn >= last) { nums3[i] = mn; }\n        else if(mx >= last) { \n            nums3[i] = mx;\n            if(lastInd == -1) lastInd = i;\n        }\n        else { nums3[i] = mn; }\n                            \n        //check for break of the non-decreasing order\n        if(mx < last) { \n            if(lastInd != -1) { i = lastInd - 1;  lastInd = -1; }\n            else i--;\n            last = 0;  back = i+1;\n        }\n        else {  last = nums3[i];   ans = max(ans, i - back  + 1); }\n    }\n    return ans;\n}\n```\n\n<b>Here is an article of my last interview experience - A Journey to FAANG Company, I recomand you to go through this to know which all resources I have used & how I cracked interview at Amazon:\nhttps://leetcode.com/discuss/interview-experience/3171859/Journey-to-a-FAANG-Company-Amazon-or-SDE2-(L5)-or-Bangalore-or-Oct-2022-Accepted
['C++']