Question: I am looking to sort a string list numerically which has both string and number also as a string. 

['har 1', 'zee 3']

expected output : 
zee 3
har 1

Answer: 
I found 2 problems:

* The Q3 recursion only starts from cells in the top row and the
right-most column. It should start from every cell. So simply loop all cells using 2 for loops instead of using recursion (although that could be done too, of course).
* 2 of the if statements were wrong. See `>= 0` in 2 of the if statements below.

The 2 problems are fixed here:

```
public static int longestSlope(int[][] A, int num) {
    int max = 0;
    for (int row = 0; row < A.length; row++) {
        for (int col = 0; col < A[0].length; col++) {
            max = Math.max(max, Q3(A, num, row, col, 1));
        }
    }
    return max;
}

private static int Q3(int[][] A, int NUM1, int ind1, int ind2, int Step) {
    if ((ind1 + 1) < A.length && A[(ind1 + 1)][(ind2 + 0)] == A[ind1][ind2] - NUM1)
        return Q3(A, NUM1, ind1 + 1, ind2, Step + 1);
    if ((ind1 - 1) >= 0 && A[(ind1 - 1)][(ind2 + 0)] == A[ind1][ind2] - NUM1)
        return Q3(A, NUM1, ind1 - 1, ind2, Step + 1);
    if ((ind2 + 1) < A[0].length && A[(ind1 - 0)][(ind2 + 1)] == A[ind1][ind2] - NUM1)
        return Q3(A, NUM1, ind1, ind2 + 1, Step + 1);
    if ((ind2 - 1) >= 0 && A[(ind1 + 0)][(ind2 - 1)] == A[ind1][ind2] - NUM1)
        return Q3(A, NUM1, ind1, ind2 - 1, Step + 1);
    else return Step; //if a cell next to current index is in the same slop move to that cell and add 1 step
}

```
I think you need to rethink your strategy. I'm guessing your code is not doing what you want it to do.

This is what happens in your code: The method recursion will first call itself five times because of the first if statement (col) and then five times because of the second if statement (row). Then it will call Q3 a five times (although I would have guessed 10 times at a first glance). None of the if statements in Q3 evaluate to true to Q3 always returns/fallbacks on 0 (Step).

Please explain what "the int Num given by the user is remainder of the cell next to it". Is it that the difference (cell1-cell2) must be equal to Num. If so, fix your sample matrix since there is no valid path where the difference between the cells is 1 (Num).

Also explain how the step-jumping works. Does it start from and/or end in a specific position? Can it be in any direction (here the answer is probably 'yes')?