Skip to content

Commit 0226f35

Browse files
committed
Solution as on 25-03-2022 07:40 pm
1 parent 6ab1185 commit 0226f35

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

0074. Search a 2D Matrix.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// 74.✅ Search a 2D Matrix
2+
3+
class Solution
4+
{
5+
public:
6+
bool searchMatrix(vector<vector<int>> &matrix, int target)
7+
{
8+
for (int i = 0; i < matrix.size(); ++i)
9+
{
10+
for (int j = 0; j < matrix[0].size(); ++j)
11+
{
12+
if (matrix[i][j] == target)
13+
return true;
14+
}
15+
}
16+
return false;
17+
}
18+
};

0 commit comments

Comments
 (0)