当前位置:网站首页>In situ merging of two arrays with two pointers
In situ merging of two arrays with two pointers
2022-06-30 14:37:00 【Douglas_ LT】
A daily topic ing, Today is a day easy topic 88. Merge Sorted Array
class Solution {
public:
void merge(vector<int>& nums1, int m, vector<int>& nums2, int n)
{
int pos=nums1.size()-1;
int i=m-1,j=n-1;
while(i>=0&&j>=0)
{
int temp=max(nums1[i],nums2[j]);
if(nums1[i]>nums2[j]) i--;
else j--;
nums1[pos]=temp;
pos--;
}
while(j>=0&&pos>=0){
nums1[pos]=nums2[j];
j--;pos--;
}
}
};
边栏推荐
- Shangpinhui knowledge points of large e-commerce projects
- Logiciel de récupération de données easyrecovery15 téléchargement
- Detailed explanation of the first three passes of upload Labs
- 【BUUCTF】[GXYCTF2019]Ping Ping Ping1
- Is it troublesome for CITIC futures to open an account? Is it safe? How much is the handling charge for opening an account for futures? Can you offer a discount
- PHP common authentication / third-party methods
- Three ways and differences of defining functions in JS
- ot initialized – call ‘refresh’ before invoking lifecycle methods via the context: Root WebApplicati
- XSS challenge (6-10) more detailed answers
- [geek challenge 2019] PHP problem solving record
猜你喜欢

The first dark spring cup dnuictf

August 24, 2021 deque queue and stack
![【BUUCTF】[GXYCTF2019]Ping Ping Ping1](/img/dc/4d87dfb0c2fa9cd75b54e092fd3971.jpg)
【BUUCTF】[GXYCTF2019]Ping Ping Ping1

MySQL back to table query optimization

PS cutting height 1px, Y-axis tiling background image problem

KnightCTF WEB

DiceCTF - knock-knock
![[buuctf] [actf2020 freshman competition]include](/img/42/50439290177fdea5f431e315cac1a1.jpg)
[buuctf] [actf2020 freshman competition]include

On simple code crawling Youdao translation_ 0's problem (to be solved)

Shell programming overview
随机推荐
Zend studio how to import an existing project
[extensive reading of papers] analyzing connections between user attributes, images, and text
Wechat applet realizes map navigation + door-to-door recycling
After the MySQL service on the local computer is started and stopped, some services will automatically stop when they are not used by other services or programs
Implement a long-click list pop-up box on apiccloud
Begin End use the pit encountered
PHP recursive multi-level classification, infinite classification
LeetCode_ Stack_ Medium_ 227. basic calculator II (without brackets)
notepad正则删除关键词所在行
[geek challenge 2019] PHP problem solving record
Clear the route cache in Vue
Advanced usage of go language for loop break and continue
On simple code crawling Youdao translation_ 0's problem (to be solved)
Data recovery software easyrecovery15 Download
PHP reverses scenarios based on code and skillfully uses debug_ backtrace()
中信期货开户麻烦吗安全吗,期货开户手续费是多少,能优惠吗
数据恢复软件EasyRecovery15下载
MySQL back to table query optimization
Fastcgi CGI shallow understanding
Add attributes to multimode