当前位置:网站首页>2022-1-6 Niuke net brush sword finger offer
2022-1-6 Niuke net brush sword finger offer
2022-07-03 09:09:00 【weixin_ thirty-seven million six hundred and eighty-two thousan】
JZ53 The number of times a number appears in an ascending array 
error :class Solution {
public:
int GetNumberOfK(vector data ,int k) {
// Bubble sort
error 1// if(!data) return -1;
error 2// if(data.size==0) return -1;
int ans=0;
for(int i=0; i<data.size(); ++i){
// as long as data[i] And k equal ,ans++
//data[i]>k when break Stop the cycle
if(data[i] == k) ans++;
if(data[i]>k) break;
}
return ans;
}
};
error 1:
error 2: When the input is two parameters ,1 Is an array ,2 For the number to find in the array . About whether the two are empty 4 In this case :1 empty 2 empty ,1 empty 2 Not empty ,1 Not empty 2 empty ,1 Not empty 2 Not empty . In this question, you find numbers in an array , If 1 empty , It doesn't matter 2 How many , Will not find , No special treatment . If 1 Not empty ,2 There is no special treatment for several .
Insert picture description here 
error 1: Calculation mid Should be mid = l+(r-l)/2
The mistake is mid = l+(l-r)/2 Insert picture description here 





The official solution code is as follows 
JZ11 Minimum number of rotation array 

error : You should not set the minimum value yourself , Instead, a value in the array is used as the starting value .
JZ10 Fibonacci sequence 

error : Logic error , If 0 or 1, Push the 1, Other situations , Push the vi[i-1] + vi[i-2]
JZ42 The maximum sum of successive subarrays 

error :vector Assignment cannot be used dp[0]= Should use the dp.push_back(
边栏推荐
- <, < <,>, > > Introduction in shell
- 传统办公模式的“助推器”,搭建OA办公系统,原来就这么简单!
- Shell script kills the process according to the port number
- STM32F103 can learning record
- State compression DP acwing 291 Mondrian's dream
- 【点云处理之论文狂读前沿版10】—— MVTN: Multi-View Transformation Network for 3D Shape Recognition
- Common DOS commands
- 低代码起势,这款信息管理系统开发神器,你值得拥有!
- Mortgage Calculator
- LeetCode 324. Swing sort II
猜你喜欢

Sword finger offer II 029 Sorted circular linked list

State compression DP acwing 91 Shortest Hamilton path

低代码前景可期,JNPF灵活易用,用智能定义新型办公模式
![[point cloud processing paper crazy reading frontier version 10] - mvtn: multi view transformation network for 3D shape recognition](/img/94/2ab1feb252dc84c2b4fcad50a0803f.png)
[point cloud processing paper crazy reading frontier version 10] - mvtn: multi view transformation network for 3D shape recognition

Six dimensional space (C language)

Save the drama shortage, programmers' favorite high-score American drama TOP10

网络安全必会的基础知识

Gaussian elimination acwing 883 Gauss elimination for solving linear equations

LeetCode 715. Range module

Divide candy (circular queue)
随机推荐
【点云处理之论文狂读前沿版8】—— Pointview-GCN: 3D Shape Classification With Multi-View Point Clouds
State compression DP acwing 91 Shortest Hamilton path
Shell script kills the process according to the port number
LeetCode 513. Find the value in the lower left corner of the tree
Instant messaging IM is the countercurrent of the progress of the times? See what jnpf says
SQL statement error of common bug caused by Excel cell content that is not paid attention to for a long time
What is the difference between sudo apt install and sudo apt -get install?
String splicing method in shell
LeetCode 1089. Duplicate zero
LeetCode 57. Insert interval
Data mining 2021-4-27 class notes
传统企业数字化转型需要经过哪几个阶段?
Common penetration test range
DOM render mount patch responsive system
【点云处理之论文狂读经典版10】—— PointCNN: Convolution On X-Transformed Points
LeetCode 241. 为运算表达式设计优先级
低代码起势,这款信息管理系统开发神器,你值得拥有!
【点云处理之论文狂读经典版7】—— Dynamic Edge-Conditioned Filters in Convolutional Neural Networks on Graphs
How to delete CSDN after sending a wrong blog? How to operate quickly
剑指 Offer II 029. 排序的循环链表