Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public:
- int countNegatives(vector<vector<int>>& grid) {
- int ans=0;
- for(auto u : grid)
- {
- reverse(u.begin(),u.end());
- int l=lower_bound(u.begin(),u.end(),0)-u.begin();
- ans+=l;
- }
- return ans;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement