当前位置:网站首页>Jianzhi offer 04 (implemented in C language)
Jianzhi offer 04 (implemented in C language)
2022-07-04 10:24:00 【sqjddb】
In a n * m In a two-dimensional array , Each row is sorted in ascending order from left to right , Each column is sorted in ascending order from top to bottom . Please complete an efficient function , Enter such a two-dimensional array and an integer , Determine whether the array contains the integer .
bool findNumberIn2DArray(int** matrix, int matrixSize, int* matrixColSize, int target){
if(matrixSize==0||*matrixColSize==0)
return false;
for(int col=*matrixColSize-1,row=0;row<matrixSize&&col>=0;)
{
if(matrix[row][col]==target)
return true;
else if(matrix[row][col]>target)
col--;
else
row++;
}
return false;
}
边栏推荐
- Static comprehensive experiment ---hcip1
- El Table Radio select and hide the select all box
- MySQL develops small mall management system
- Hands on deep learning (43) -- machine translation and its data construction
- Go context basic introduction
- PHP代码审计3—系统重装漏洞
- 【Day2】 convolutional-neural-networks
- Kotlin: collection use
- 2021-08-10 character pointer
- Rhcsa - day 13
猜你喜欢
Servlet基本原理与常见API方法的应用
leetcode842. Split the array into Fibonacci sequences
Occasional pit compiled by idea
Hands on deep learning (41) -- Deep recurrent neural network (deep RNN)
Summary of reasons for web side automation test failure
【OpenCV 例程200篇】218. 多行倾斜文字水印
uniapp 小于1000 按原数字显示 超过1000 数字换算成10w+ 1.3k+ 显示
5g/4g wireless networking scheme for brand chain stores
【Day1】 deep-learning-basics
C language pointer interview question - the second bullet
随机推荐
Some summaries of the third anniversary of joining Ping An in China
2021-08-10 character pointer
leetcode1-3
使用 C# 提取 PDF 文件中的所有文字(支持 .NET Core)
Three schemes of ZK double machine room
今日睡眠质量记录78分
7-17 crawling worms (15 points)
对于程序员来说,伤害力度最大的话。。。
Hands on deep learning (41) -- Deep recurrent neural network (deep RNN)
Today's sleep quality record 78 points
【OpenCV 例程200篇】218. 多行倾斜文字水印
DML statement of MySQL Foundation
Reasons and solutions for the 8-hour difference in mongodb data date display
Network disk installation
VLAN part of switching technology
Es entry series - 6 document relevance and sorting
From programmers to large-scale distributed architects, where are you (2)
Lavel document reading notes -how to use @auth and @guest directives in lavel
Dos:disk operating system, including core startup program and command program
SQL replying to comments