int editDistanceLesserSpace(String s1, String s2){
        if(s1==null && s2==null)
            return 0;
        else if(s1==null)
            return s2.length();
        else if(s2==null)
            return s1.length();
        else {
            int l1 = s1.length();
            int l2 = s2.length();
            int current = 0;
            int prev = -1;
            int[][] dp = new int[2][l2+1];
            for(int i=0;i<=l1;i++){
                for(int j=0;j<=l2;j++){
                    if(i==0)
                        dp[current][j]=j;
                    else if(j==0)
                        dp[current][j]=i;
                    else if(s1.charAt(i-1)==s2.charAt(j-1)){
                        dp[current][j] = dp[prev][j-1];
                    }
                    else{
                        dp[current][j]=Math.min(Math.min(
                                dp[prev][j]+DELETE , //delete s1[i]
                                dp[current][j-1]+INSERT ), //insert s2[j]
                                dp[prev][j-1]+REPLACE); //replace s1[i] with s2[j];
                    }
                }
                prev = current;
                current = 1-current;

            }
            return dp[prev][l2];
        }
    }