Leetcode 2732. Find a Good Subset of the Matrix
Given m binary rows (n ≤ 5), find any nonempty subset of row indices such that for each column the number of 1s in the subset is at most floor(k/2) where k is the subset size. The core challenge is to balance per-column 1-counts against subset size — with small n you can encode rows as bitmasks and use frequency-based enumeration of mask combinations to find a compatible subset.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.