# Message from C, C++ discussions

December 2019

— Please Solve This

Given a matrix mxn matrix(m,n>3).You have to perform the following operations:

i) Find the same consecutive numbers in the matrix either vertically, horizontally or diagonally such that atleast four consecutive nos. are there.

ii) If there are more than one such set of numbers then print an integer outnum which is the minimum of such consecutive nos.

iii) If no such no. exists print -1.

Input Format

Input: first line contains two space separated integer m and n. Second m lines have n space separated integers.

Constraints

2<=m,n<=1000

Output Format

Output: an integer outnum or -1 if no such nos. exists

Sample Input 0

[29/12, 8:43 PM] FaizI New: output:_

[29/12, 8:44 PM] FaizI New: 5 6

7 8 9 5 4 2

5 7 9 4 5 2

6 8 7 9 2 2

1 4 2 7 6 2

1 1 1 1 1 4

Sample Output 0

1

Explanation 0

Here, There are two number such nos. which is consecutive for 4 times either in row ,column ,diagonals(i.e 1 and 2). Now print the min of( 1,2) ,which is 1.

/warn Read the rules: No one will solve your task. Only questions with your code problems to impliment.

— User Sultan has 1/2 warnings; be careful!

The latest warn was because:

Read the rules: No one will solve your task. Only questions with your code problems to impliment.

— Pls help i hv exams tommrow.

— Wow. rip your grades then

— /report

— Reported iftekhar to admins.

— Don't be all too harsh

— I m still learning. Did u learn right from the womb?

— Did you learn how to read? Because if you did you'd know that this chat isn't for doing your schoolwork, dear~

— I just want to know where is the mistake.?feet and inches out put shows 0

— I will leave this group. Right after