Take a matrix A consisting positive integers, and a single positive integer N as input, and determine if there are at least N consecutive occurrences of the same number in any row or column in the matrix.
You need only test horizontally and vertically.
Test cases
N = 1
A =
1
Result: True
----------------
N = 3
A =
1 1 1
2 2 3
Result: True
----------------
N = 4
A =
1 1 1
2 2 3
Result: False
----------------
N = 3
A =
3 2 3 4 2 1
4 1 4 2 4 2
4 2 3 3 4 1
1 1 2 2 3 4
3 2 3 1 3 1
1 1 2 2 3 4
Result: True
----------------
N = 1
A =
5 2 3 8
Result: True
----------------
N = 3
111 23 12 6
111 53 2 5
112 555 5 222
Result: False
----------------
N = 2
4 2 6 2 1 5
2 3 3 3 3 3
11 34 4 2 9 7
Result: True
Explanations are always a good thing :)