Write a program that finds the row in the given NxM matrix with longest sequence that contains same values. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Write a program that finds the row in the given NxM matrix with longest sequence that contains same values.

The "sequence" in this context means the elements that are located one after one. Input: First line contains N and M (1<=N,M<=100) Than whole matrix is given( Value of each element of the matrix is not bigger that 1000). Output: Output have to be in the following format: Longest series is in the string < row number > If no sequence can be found output: No series of equal elements Input Output 4 4 Longest series is in the string 2 1 2 3 4 2 3 4 6 1 1 1 5 2 2 1 6 What is wrong? https://code.sololearn.com/c75I2NZhq6Td/#cpp

11th Oct 2020, 4:50 PM
Azat Malgazhdar
Azat Malgazhdar - avatar
1 Answer
0
Your code outputs 2 for the test case you specified so why do you think something is wrong? Were you expecting something other than 2 for your input of this? 4 4 1 2 3 4 2 3 4 6 1 1 1 5 2 2 1 6 A test case that doesn't return the expected result would be more clear.
11th Oct 2020, 5:12 PM
Josh Greig
Josh Greig - avatar