Find the row index that has the maximum number of 1s in a boolean 2D matrix.
Difficulty: Medium
Phase: 6 · Mixed Logical Challenges
XP Reward: 20 XP
Topics: Mixed Logical Challenges, Medium
Supported Languages: Python, JavaScript, C, C++, Java
Problem Description
Given R and C followed by boolean matrix (0s and 1s), find 0-based row index with maximum number of 1s. Input Format: Read input from standard input (stdin). Output Format: Print the result to standard output (stdout).
Constraints
- -10^9 <= N <= 10^9
Examples
Example 1
Input: 3 4 0 1 1 1 0 0 1 1 1 1 1 1
Output: 2
Explanation: Sample execution for input 3 4 0 1 1 1 0 0 1 1 1 1 1 1