 New update is available. Click here to update. Close
Topic list
Ninja And The Rows
EASY
15 mins 7 upvotes
Matrices (2D Arrays)
Topics (Covered in this problem)
Problem solved
Skill meter Matrices (2D Arrays)
-
-
Other topics
Problem solved
Skill meter Strings
-
- -
- Sorting
-
- Binary Search
-
- Stacks & Queues
-
- Trees
-
- Graph
-
- Dynamic Programming
-
- Greedy
-
- Tries
-
- Arrays
-
- SQL
-
- Binary Search Trees
-
- Heap
-
- Bit Manipulation
-
-
Solve problems & track your progress
Checkout your overall progress in every topic here
Become Sensei
in DSA topics
Open the topic and solve more problems associated with it to improve your skills
Check out the skill meter for every topic
See how many problems you are left with to solve for cracking any stage. Score more than zero to get your progress counted.

# Ninja And The Rows

Easy 0/40
Avg time to solve 15 mins
Success Rate 87 % Share 7 upvotes

## Problem Statement

#### Your task is to help the ninja find the maximum weight amongst all the rows.

##### EXAMPLE:
``````Input: 'N' = 2, 'M' = 3, 'MAT' = [[1, 2, 3], [2, 0, 0]]
Output: 6

The weight of first row is 1 + 2 + 3 = 6
The weight of the second row is 2 + 0 + 0 = 2; hence the answer will be a maximum of 2 and 6, which is 6.
``````
Detailed explanation ( Input/output format, Notes, Constraints, Images ) ##### Sample Input 1 :
``````2
3 3
1 2 3
3 4 2
3 4 2
1 1
2
``````
##### Sample Output 1 :
``````9
2
``````
##### Explanation Of Sample Input 1 :
``````For the first test case, the answer will be 9. It will be formed by the 2nd row, and it will be the maximum amongst all.

For the first test case, as there is only one row, the answer will be its sum which is 2.
``````
##### Sample Input 2 :
``````2
1 3
1 2 3
4 2
2 2
3 4
2 4
4 5
``````
##### Sample Output 2 :
``````6
9
``````  Auto Console