<p>Given two integer arrays&nbsp;<code>arr1</code> and <code>arr2</code>, return the minimum number of operations (possibly zero) needed&nbsp;to make <code>arr1</code> strictly increasing.</p>

<p>In one operation, you can choose two indices&nbsp;<code>0 &lt;=&nbsp;i &lt; arr1.length</code>&nbsp;and&nbsp;<code>0 &lt;= j &lt; arr2.length</code>&nbsp;and do the assignment&nbsp;<code>arr1[i] = arr2[j]</code>.</p>

<p>If there is no way to make&nbsp;<code>arr1</code>&nbsp;strictly increasing,&nbsp;return&nbsp;<code>-1</code>.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> arr1 = [1,5,3,6,7], arr2 = [1,3,2,4]
<strong>Output:</strong> 1
<strong>Explanation:</strong> Replace <code>5</code> with <code>2</code>, then <code>arr1 = [1, 2, 3, 6, 7]</code>.
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> arr1 = [1,5,3,6,7], arr2 = [4,3,1]
<strong>Output:</strong> 2
<strong>Explanation:</strong> Replace <code>5</code> with <code>3</code> and then replace <code>3</code> with <code>4</code>. <code>arr1 = [1, 3, 4, 6, 7]</code>.
</pre>

<p><strong class="example">Example 3:</strong></p>

<pre>
<strong>Input:</strong> arr1 = [1,5,3,6,7], arr2 = [1,6,3,3]
<strong>Output:</strong> -1
<strong>Explanation:</strong> You can&#39;t make <code>arr1</code> strictly increasing.</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= arr1.length, arr2.length &lt;= 2000</code></li>
	<li><code>0 &lt;= arr1[i], arr2[i] &lt;= 10^9</code></li>
</ul>

<p>&nbsp;</p>

class Solution {
public:
    //int makeArrayIncreasing(vector<int>& arr1, vector<int>& arr2) {
/*int print0(vector<int> b,vector<int> c,int e,int temp0){
    if(e==b.size()){
        return 0;
    }
    int temp2=INT_MAX;
    if(e==0){
        temp2=print0(b,c,e+1,temp0);
        for(int temp12=0;temp12<c.size();temp12++){
            int temp18=print0(b,c,e+1,temp12);
            if(temp18!=INT_MAX){
                temp18=temp18+1;
            }
            temp2=min(temp2,temp18);
        }
    }
    else if(e!=0){
        if(temp0==-1){
            if(b[e]>b[e-1]){
                temp2=print0(b,c,e+1,temp0);
            }
            for(int temp12=0;temp12<c.size();temp12++){
                if(c[temp12]>b[e-1]){
                int temp18=print0(b,c,e+1,temp12);
                if(temp18!=INT_MAX){
                    temp18=temp18+1;
                }
                temp2=min(temp2,temp18);
                }
            }
        }
        else if(temp0!=-1){
            if(b[e]>c[temp0]){
                temp2=print0(b,c,e+1,-1);
            }
            for(int temp12=0;temp12<c.size();temp12++){
                if(c[temp12]>c[temp0]){
                int temp18=print0(b,c,e+1,temp12);
                if(temp18!=INT_MAX){
                    temp18=temp18+1;
                }
                temp2=min(temp2,temp18);
                }
            }
        }
    }
    return temp2;
}
int makeArrayIncreasing(vector<int> b,vector<int> c){
    int e=0;
    int temp0=-1;
    int temp2=0;
    int temp12=0;
    temp2=print0(b,c,e,temp0);
    int temp18=0;
    if(temp2!=INT_MAX){
        temp18=temp2;
    }
    else if(temp2==INT_MAX){
        temp18=-1;
    }
    return temp18;
    }*/
    int print0(vector<int> &b,vector<int> &c,vector<vector<int>> &e,int temp0,int temp2){
    if(temp0==b.size()){
        return 0;
    }
    int temp12=INT_MAX;
    if(temp2==-1){
        if(e[temp0][c.size()]!=-1){
            return e[temp0][c.size()];
        }
    }
    else if(temp2!=-1){
        if(e[temp0][temp2]!=-1){
            return e[temp0][temp2];
        }
    }
    if(temp0==0){
        temp12=print0(b,c,e,temp0+1,temp2);
        for(int temp18=0;temp18<c.size();temp18++){
            int temp28=print0(b,c,e,temp0+1,temp18);
            if(temp28!=INT_MAX){
                temp28=temp28+1;
            }
            temp12=min(temp12,temp28);
        }
    }
    else if(temp0!=0){
        if(temp2==-1){
            if(b[temp0]>b[temp0-1]){
                temp12=print0(b,c,e,temp0+1,temp2);
            }
            int temp18=0;
            int temp28=c.size()-1;
            int temp48=(temp18+temp28)/2;
            int temp72=-1;
            while(temp18<=temp28){
                temp48=(temp18+temp28)/2;
                if(c[temp48]>b[temp0-1]){
                    temp72=temp48;
                    temp28=temp48-1;
                }
                else if(c[temp48]<=b[temp0-1]){
                    temp18=temp48+1;
                }
            }
            if(temp72!=-1){
                int temp78=print0(b,c,e,temp0+1,temp72);
                if(temp78!=INT_MAX){
                    temp78=temp78+1;
                }
                temp12=min(temp12,temp78);
            }
        }
        else if(temp2!=-1){
            if(b[temp0]>c[temp2]){
                temp12=print0(b,c,e,temp0+1,-1);
            }
            int temp18=0;
            int temp28=c.size()-1;
            int temp48=(temp18+temp28)/2;
            int temp72=-1;
            while(temp18<=temp28){
                temp48=(temp18+temp28)/2;
                if(c[temp48]>c[temp2]){
                  temp72=temp48;
                  temp28=temp48-1;
                }
                else if(c[temp48]<=c[temp2]){
                    temp18=temp48+1;
                }
            }
            if(temp72!=-1){
                /*for(int temp78=temp72;temp78<c.size();temp78++){
                    int temp92=print0(b,c,e,temp0+1,temp78);
                    if(temp92!=INT_MAX){
                        temp92=temp92+1;
                    }
                    temp12=min(temp12,temp92);
                }*/
                int temp78=print0(b,c,e,temp0+1,temp72);
                if(temp78!=INT_MAX){
                    temp78=temp78+1;
                }
                temp12=min(temp12,temp78);
            }
        }
    }
    if(temp2==-1){
        e[temp0][c.size()]=temp12;
    }
    else if(temp2!=-1){
        e[temp0][temp2]=temp12;
    }
    return temp12;
}
int makeArrayIncreasing(vector<int> b,vector<int> c){
    vector<vector<int>> e;
    for(int temp0=0;temp0<b.size();temp0++){
        vector<int> temp2;
        for(int temp12=0;temp12<c.size()+1;temp12++){
            temp2.push_back(-1);
        }
        e.push_back(temp2);
    }
    int temp0=0;
    int temp2=-1;
    int temp12=0;
    int temp18=0;
    sort(c.begin(),c.end());
    temp12=print0(b,c,e,temp0,temp2);
    int temp28=0;
    if(temp12!=INT_MAX){
        temp28=temp12;
    }
    else if(temp12==INT_MAX){
        temp28=-1;
    }
    return temp28;
}
};
112226