当前位置:网站首页>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(
边栏推荐
- LeetCode 871. Minimum refueling times
- LeetCode 715. Range 模块
- Basic knowledge of network security
- Sword finger offer II 029 Sorted circular linked list
- DOM 渲染系统(render mount patch)响应式系统
- LeetCode 1089. 复写零
- Character pyramid
- <, < <,>, > > Introduction in shell
- TP5 order multi condition sort
- STM32F103 can learning record
猜你喜欢

State compression DP acwing 291 Mondrian's dream

How to place the parameters of the controller in the view after encountering the input textarea tag in the TP framework

樹形DP AcWing 285. 沒有上司的舞會

Format - C language project sub file

Wonderful review | i/o extended 2022 activity dry goods sharing

On the setting of global variable position in C language

LeetCode 513. 找树左下角的值
![[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

I made mistakes that junior programmers all over the world would make, and I also made mistakes that I shouldn't have made

CSDN markdown editor help document
随机推荐
AcWing 787. Merge sort (template)
【点云处理之论文狂读经典版11】—— Mining Point Cloud Local Structures by Kernel Correlation and Graph Pooling
LeetCode 30. Concatenate substrings of all words
剑指 Offer II 029. 排序的循环链表
LeetCode 535. Encryption and decryption of tinyurl
DOM 渲染系统(render mount patch)响应式系统
Digital statistics DP acwing 338 Counting problem
Noip 2002 popularity group selection number
LeetCode 871. 最低加油次数
cres
LeetCode 513. Find the value in the lower left corner of the tree
高斯消元 AcWing 883. 高斯消元解线性方程组
dried food! What problems will the intelligent management of retail industry encounter? It is enough to understand this article
Complex character + number pyramid
On the difference and connection between find and select in TP5 framework
LeetCode 30. 串联所有单词的子串
How to place the parameters of the controller in the view after encountering the input textarea tag in the TP framework
PIC16F648A-E/SS PIC16 8位 微控制器,7KB(4Kx14)
I made mistakes that junior programmers all over the world would make, and I also made mistakes that I shouldn't have made
STM32F103 can learning record