VOOZH about

URL: https://www.geeksforgeeks.org/videos/problem-of-the-day-29072024-row-with-max-1s/

⇱ Row with maximum number of 1s - GeeksforGeeks | Videos


April 23, 2026 |2.0K Views

Row with maximum number of 1s

Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Saurabh Bansal We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Arrays but also build up problem-solving skills.

Given a boolean 2D array, consisting of only 1's and 0's, where each row is sorted. Return the 0-based index of the first row that has the most number of 1s. If no such row exists, return -1.

Examples:

Input: arr[][] = [[0, 1, 1, 1],
                         [0, 0, 1, 1],
                         [1, 1, 1, 1],
                         [0, 0, 0, 0]]
Output: 2
Explanation: Row 2 contains 4 1's (0-based indexing).

Give the problem a try before going through the video. All the best!!!
Problem Link: https://practice.geeksforgeeks.org/problems-preview/row-with-max-1s0023/1

Recommendations
3.5K Views | 10/01/2025...
Get level of a node in binary tree Iterative approach
27.5K Views | 10/01/2025...
Implement two stacks in an array
33.8K Views | 10/01/2025...
Longest Palindromic Subsequence
10.7K Views | 10/01/2025...
Maximum Sum Increasing Subsequence
17.9K Views | 10/01/2025...
Iterative Postorder Traversal
7.2K Views | 10/01/2025...
Sort a linked list of 0s, 1s and 2s
11.5K Views | 09/01/2025...
Segment Tree | Set 2 (Range Minimum Query)
16.7K Views | 09/01/2025...
Convert a given Binary Tree to Doubly Linked List | Set 3
10.2K Views | 08/01/2025...
SDE Sheet - Special Keyboard
11.9K Views | 08/01/2025...
Length of the longest valid substring