From 3147a346cd6ba85008739faa1209c829d4bbd547 Mon Sep 17 00:00:00 2001 From: harshulab <70436557+harshulab@users.noreply.github.com> Date: Tue, 20 Oct 2020 21:42:16 +0530 Subject: [PATCH] Create 1351:Count Negative Numbers in a Sorted Matrix C++ solution to count negative numbers in a sorted m*n matrix. LeetCode solution --- ...1:Count Negative Numbers in a Sorted Matrix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 C++/1351:Count Negative Numbers in a Sorted Matrix diff --git a/C++/1351:Count Negative Numbers in a Sorted Matrix b/C++/1351:Count Negative Numbers in a Sorted Matrix new file mode 100644 index 0000000..d04501b --- /dev/null +++ b/C++/1351:Count Negative Numbers in a Sorted Matrix @@ -0,0 +1,18 @@ +//Time complexity O(m*n) + +class Solution +{ +public: + int countNegatives(vector>& grid) + { + int count = 0; + for(int i=0; i