given a matrix find number of rows which are sorted in either increasing or decreasing order
Answers
Answered by
0
Count all sorted rows in a matrix
Given a matrix of m*n size, the task is to count all the rows in a matrix that are sorted either in strictly increasing order or in strictly decreasing order?
Examples :
Input : m = 4, n = 5 mat[m][n] = 1 2 3 4 5 4 3 1 2 6 8 7 6 5 4 5 7 8 9 10 Output: 3
Given a matrix of m*n size, the task is to count all the rows in a matrix that are sorted either in strictly increasing order or in strictly decreasing order?
Examples :
Input : m = 4, n = 5 mat[m][n] = 1 2 3 4 5 4 3 1 2 6 8 7 6 5 4 5 7 8 9 10 Output: 3
Similar questions