Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Search a 2D Matrix
bool searchMatrix(vector<vector<int>>& matrix, int target) { int m=matrix.size(); if(m==0) return false; int n=matrix[0].size(); int i=0; int j=n-1; while(i<=m-1 && j>=0) { if(matrix[i][j]==target) { return true; } else if(matrix[i][j]>target) { j--; } else { i++; } } return false; } };
run
|
edit
|
history
|
help
0
unordered_map
1
Dar
random
Certificate Printing
reverseKNode
ListCPP
RotateMat
new delete malloc free
NonparaRuns