반응형
grid.size() vs grid[0].size()
class Solution {
public:
int countNegatives(vector<vector<int>>& grid) {
int ans=0;
for(int i = 0;i<grid.size();i++)
for(int j = 0;j<grid[0].size();j++)
if(grid[i][j]<0)
ans++;
return ans;
}
};
반응형
'IT > 알고리즘' 카테고리의 다른 글
36] Leetcode 1460. Make Two Arrays Equal by Reversing Sub-arrays (0) | 2020.07.21 |
---|---|
35★] Leetcode 1299. Replace Elements with Greatest Element on Right Side (0) | 2020.07.19 |
33] Leetcode 1304. Find N Unique Integers Sum up to Zero (0) | 2020.07.15 |
32] Leetcode 807. Max Increase to Keep City Skyline (0) | 2020.07.12 |
31] Leetcode 1512. Number of Good Pairs (0) | 2020.07.12 |
댓글