当前位置:网站首页>324. 摆动排序 II
324. 摆动排序 II
2022-06-28 17:38:00 【anieoo】
原题链接:324. 摆动排序 II
solution:
class Solution {
public:
void wiggleSort(vector<int>& nums) {
vector<int> res(nums);
sort(res.begin(),res.end());
int r = res.size() - 1,l = r / 2;
for(int i = 0;i < res.size();i++) {
if(i % 2 == 0) nums[i] = res[l--];
else nums[i] = res[r--];
}
}
};边栏推荐
- 全网最全360无死角编写软件测试用例模板【建议收藏】
- Redis6 notes 04 master-slave replication, cluster, application problems, new redis6 features
- Redis 原理 - Hash
- How to open a futures account? Where is it safer to open an account?
- Visio use
- Google launches advanced API security to protect APIs from security threats
- 数字化转型中,企业设备管理会出现什么问题?JNPF或将是“最优解”
- How to upgrade from RHEL 8 to RHEL 9
- The fourth column, kubernetes cloud native combat, is coming ~
- Time effective simulation platform based on dataworks | acquisition technology
猜你喜欢

单片机修改网络硬件驱动(phy芯片更换)

Leetcode 6. Zigzag transformation (awesome, solved)

2022危险化学品经营单位主要负责人复训题库及在线模拟考试

IDC: Alibaba cloud ranks first in the market share of China's data governance platform in 2021

数据库MySQL语句期末复习 CTGU

Squid代理服务器应用(我从远方赶来,赴你一面之约)

面部識別試驗涉及隱私安全問題?國外一公司被緊急叫停

2022 operation of simulated examination platform of hoisting machinery command examination question bank

WPF video hard decoding, rendering and playing (no airspace) (support 4K, 8K and high frame rate video)

Squid proxy server application (I came from afar to make an appointment with you)
随机推荐
2022 operation of simulated examination platform of hoisting machinery command examination question bank
Redis master-slave replication, sentinel, cluster cluster principle + experiment (wait, it will be later, but it will be better)
Currency circle earthquake: earned 1million last year and lost 5million this year
A few lines of code can realize complex excel import and export. This tool class is really powerful!
Is the account opening link given by CICC securities manager safe? Who can I open an account with?
Google推出Advanced API Security 保护API免受安全威胁
为什么 insert 配置 'SELECT LAST_INSERT_ID()' 返回个0呢?
2022危险化学品经营单位主要负责人复训题库及在线模拟考试
2022 review questions and answers for safety production management personnel of hazardous chemical production units
[official cooperation between Shang Silicon Valley and Tencent cloud] video release of Silicon Valley classroom project
Le test de reconnaissance faciale comporte - t - il des préoccupations en matière de protection de la vie privée? Une entreprise étrangère a été arrêtée en cas d'urgence
Kubernetes visual interface dashboard
nuc980心跳灯
July2022 plan (unreal)
Matlb| optimal operation and marketization of power system
DMS的SQL结果集导出支持传参数吗?
强化学习在黄页商家智能聊天助手中的探索实践
Time effective simulation platform based on dataworks | acquisition technology
Ask flynk SQL cdc Can you synchronize multiple tables and then sink them into one table? Synchronized tables can be accessed through a joi
面部识别试验涉及隐私安全问题?国外一公司被紧急叫停