Coding for given problem

Look for Manhattan distance in google.
Create a console application that receives any size of matrix
and one parameter which is the Manhattan distance, this is K.

The result should be Yes/No.
Yes if there are any two similar items (integers) in the matrix
that are in a distance of K from each other or less.

1. Number of rows.
2. Matrix rows one line after the other in a new line between each matrix line.
3. K value.
Output YES/NO