If not same , then find the larger of two and go in the direction of larger value
else if ( dp [ i - 1 ] [ j ] < dp [ i ] [ j - 1 ] ) { res = a [ i - 1 ] + res ; i -- ; } else { res = b [ j - 1 ] + res ; j -- ; } }