当前位置:网站首页>Force deduction brush question 26. Delete duplicates in the ordered array
Force deduction brush question 26. Delete duplicates in the ordered array
2022-07-25 03:21:00 【GRT should always work hard】


Use the double finger method , Ideas as follows .
class Solution {
public int removeDuplicates(int[] nums) {
if(nums.length == 0){
return 0;}
int p = 0;
int q = 1;
while(q<nums.length){
if(nums[p] != nums[q]){
nums[p+1] = nums[q];
p++;
}
q++;
}
return p+1;
}
}
边栏推荐
- Flowlayout in compose
- Consistent hash, virtual node, bloom filter
- Database transactions (often asked)
- Dc-1-practice
- Analysis of browser working principle
- Handwriting promise
- [template engine] microservice Learning Notes 6: freemaker
- 10. 509 Certificate (structure + principle)
- Solution: owner's smart site supervision cloud platform
- Use of stm32cubemonitor part I - data plotting and instrument display
猜你喜欢

How does Jupiter notebook change themes and font sizes?

Analysis of DNS domain name resolution process

List title of force buckle summary

B. Making Towers

Use of stm32cubemonitor Part II - historical data storage and network access

Openlayers draw circles and ellipses
![[template engine] microservice Learning Notes 6: freemaker](/img/6a/cfe9c5aea0f7fc83d0812237de2256.png)
[template engine] microservice Learning Notes 6: freemaker

Record once C # extract audio files with ffmempeg

JS written test question -- promise, setTimeout, task queue comprehensive question

CVPR 2020 | social stgcnn: pedestrian trajectory prediction based on graph convolution
随机推荐
JS construct binary tree
Brief understanding of operational amplifier
Page performance: how to optimize pages systematically?
NVM installation and use
A queue of two stacks
Riotboard development board series notes (VII) -- the use of framebuffer
JS written test question -- prototype, new, this comprehensive question
Use and introduction of vim file editor
List title of force buckle summary
Learning notes - talking about the data structure and algorithm of MySQL index and the introduction of index
[template engine] microservice Learning Notes 6: freemaker
B. Difference of GCDs
mysql_ Master slave synchronization_ Show slave status details
Take a note: Oracle conditional statement
Direct insert sort / Hill sort
Analysis of DNS domain name resolution process
Bubble sort / heap sort
Riotboard development board series notes (6) -- buildreoot building system image
Define macros in makefile and pass them to source code
TypeScript