Skip to content

Instantly share code, notes, and snippets.

View necusjz's full-sized avatar
🔫
AFK

necusjz

🔫
AFK
View GitHub Profile
@necusjz
necusjz / 04_FindInPartiallySortedMatrix.cpp
Last active April 25, 2019 14:24
面试题 4:二维数组中的查找
bool Find(int *matrix, int rows, int columns, int number) {
bool found = false;
if(matrix != nullptr && rows > 0 && columns > 0) {
int row = 0;
int column = columns-1;
while(row < rows && column >= 0) {
if(matrix[row * columns + column] == number) {
found = true;
break;
}