Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b16e517

Browse files
Adding a snippet
1 parent c3161ac commit b16e517

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

‎README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,3 +278,14 @@ def toLowerCase(self, str):
278278
"""
279279
return str.lower()
280280
```
281+
### Count Negatives in a sorted Matrix
282+
This method returns the count of negative numbers in a sorted matrix.
283+
```
284+
def countNegatives(self, grid: List[List[int]]) -> int:
285+
count = 0
286+
for num in grid:
287+
for n in num:
288+
if n < 0:
289+
count += 1
290+
return count
291+
```

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /