// https://leetcode.com/problems/row-with-maximum-ones/
class Solution {
public:
vector<int> rowAndMaximumOnes(vector<vector<int>>& mat) {
int pos, val{-1};
for (int i = 0, n = mat.size(); i < n; ++i) {
int cur = accumulate(mat[i].begin(), mat[i].end(), 0);
if (cur > val) val = cur, pos = i;
}
return {pos, val};
}
};
row-with-maximum-ones
Folders and files
Name | Name | Last commit date | ||
---|---|---|---|---|
parent directory.. | ||||