← Goldman Sachs questions

Row index with maximum ones in binary matrix

Filed under Goldman Sachs

Given a binary matrix of size NxM where each row is sorted in non-decreasing order, determine the row index that contains the maximum total count of 1s. If there is a tie, return the lowest row index.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Goldman Sachs questions

Collected from public candidate posts and coding forums. Updated Nov 2026.