C++: Solution with explanation
To make both array strictly increasing till \'i\' index, there is two possibility\n\n1. we do not swap the \'i\' elements.\n2. we swap the \'i\' elements.\n\nMi
To make both array strictly increasing till \'i\' index, there is two possibility\n```\n1. we do not swap the \'i\' elements.\n2. we swap the \'i\' elements.\n\nMinimum of the above two possibility is the minimum number of swap needed \nto make both the array strictly increasing till \'i\' index.\n```\n\nlet \'n\' is the size of array and take two auxilary array\n```\nnot_swap[i]: it stores the minimum swap needed to make the array strictly increasing till \'i\' index without making swap at \'i\' index.\nswap[i]    : it stores the minimum swap needed to make the array strictly increasing till \'i\' index with making swap at \'i\' index.\n```\n\nAssume we have computed till \'i-1\' element i.e\n``` \nnot_swap[i-1] : minimum swapping needed without swapping \'i-1\' element\nswap[i-1]     : minimum swapping needed with swapping \'i-1\' element\t\n```\nNow observe two condition carefully, \n1. if \'i-1\' & \'i\' elements from both array are in strictly increasing order i.e \n```\n\tif(A[i-1]<A[i] and B[i-1]<B[i]) then \n\tnot_swap[i] = not_swap[i-1], coz by definition we do not  want to swap at \'i\' index.\n\tswap[i] = swap[i-1]+1, since we swapped at \'i-1\' index and (\'i-1\' & \'i\') already strictly increasing,\n\t          we have to reverse our previous swapping of  \'i-1\' index by swapping at again at \'i\' index.\n```\n2. if cross \'i-1\' & \'i\' elements from both arrays are in strictly increasing order i.e (A[i-1]<B[i] && B[i-1]<B[i]) we can make it strictly incresing by swapping either at \'i-1\' index or \'i\' index.\n``` \n   if consider \'i-1\' index swaping then we do not have to swap at \'i\' index (not_swap[i] case)\n   if consider swapping \'i\' index then we do not have to swap at \'i-1\' index (swap[i] case). So,\n   \n\tif(A[i-1]<B[i] && B[i-1]<B[i]) then\n\tnot_swap[i] = min ( not_swap[i] ----> existing value from previous steps (1st step),\n\t\t\t\t\t\tY[i-1] ----> since by definition we are not allowed to make swap here for \'not_swap\' case, take value from \'i-1\' \'swap\' case)\n\tswap[i] = min( swap[i] ----> existing value from previous steps (1st step),\n\t\t\t\t   not_swap[i-1] + 1 ----> since by definition we must swap at \'i\' index for \'swap\' case, take value from \'i-1\' \'not_swap\' case & add 1\n\t\t\t\t)\n```\n\t\n\nIf the explanation is good enough for you, then implementation is a cake walk . Still my implementation is as follows:\n\n```\nclass Solution {\npublic:\n    int minSwap(vector<int>& A, vector<int>& B) {\n        int n = A.size();\n        vector<int> x(n,0); /*without swap at \'i\' index*/\n        vector<int> y(n,1); /*with swap at \'i\' index*/\n        for(int i=1;i<n;i++){\n\t\t\t/*assign any large value like infinity, INT_MAX or \n\t\t\tanything which is more than maximum possible answer i.e n*/\n            x[i] = y[i] = n; \n            if(A[i-1]<A[i] && B[i-1]<B[i]){\n                x[i] = x[i-1];\n                y[i] = y[i-1]+1;\n            }\n            if(A[i-1]<B[i] && B[i-1]<A[i]){\n                x[i] = min(x[i],y[i-1]);\n                y[i] = min(y[i],x[i-1]+1);\n            }\n        }\n        return min(x[n-1],y[n-1]);\n    }\n};\n```
[]