Count Negative Numbers in a Sorted Matrix LeetCode solution in C++

1
class Solution {
2
public:
3
int countNegatives(vector<vector<int>> &grid) {
4
int ans = 0;
5
for (auto hehe : grid)
6
for (int i : hehe)
7
if (i < 0) ans++;
8
return ans;
9
}
10
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0