#2397

Maximum Rows Covered by Columns

specialist · 810 · lc medium +31 · 57.7% accepted · 295 likes · top 53%

Description

You are given an m x n binary matrix matrix and an integer numSelect. Choose exactly numSelect distinct columns to maximize the number of fully covered rows.

A row is fully covered when every 1 in that row belongs to a selected column (rows of all zeros count as covered).

Return the maximum number of rows that can be covered.

Code

1
2
3