Binary Matrix
Practice
3.8 (10 votes)
Algorithms
Easy
Greedy algorithms
Implementation
String manipulation
Problem
82% Success 8340 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

N numbers were converted into their respective Binary form of M length and arranged in an NxM matrix.

Your task is to find the index of row (1 based indexing) which contains the binary number with maximum value. If multiple rows have maximum value then print the row with minimum index.

Input:

The first line contains two space separated integers N and M, denoting number of rows and number of columns in matrix respectively.

Each of the next N lines contains a number in binary form.

Output:

Print the index of row in a single line.

Constraints:

\(1 \le N,M \le 10^3\)
\(0 \le mat[i][j] \le 1\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
390 votes
Tags:
ApprovedBrute-force searchEasyGreedy AlgorithmsOpenSorting
Points:10
49 votes
Tags:
Ad-HocVery-EasySimple-math
Points:20
23 votes
Tags:
Basics of Greedy AlgorithmsAlgorithmsGreedy Algorithms