当前位置:网站首页>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--];
}
}
};边栏推荐
- July2022 plan (unreal)
- 2022年山东省安全员C证考试练习题及模拟考试
- 2022a special equipment related management (elevator) special operation certificate examination question bank and online simulation examination
- Introduction to PMD source code analyzer
- R programming language - Introduction
- The fourth largest operator cannot be a "catfish"
- Currency circle earthquake: earned 1million last year and lost 5million this year
- 此虚拟机的处理器所支持的功能不同于保存虚拟机状态的虚拟机的处理器所支持的功能
- Packet capturing and sorting out external Fiddler -- understanding the toolbar [1]
- How to back up a WordPress database
猜你喜欢

Q: how bad can a programmer be?
![Halcon knowledge: matrix topic [01]](/img/d3/2726da70c41c7adccc3474be6f51c8.png)
Halcon knowledge: matrix topic [01]

Architecture autonomy service: building data-driven architecture insight

Redis6 notes 04 master-slave replication, cluster, application problems, new redis6 features

How to do a good job of gateway high availability protection in the big promotion scenario

NoSQL redis configuration and optimization (I blew the night breeze of Qinhuai River for you when you were not in Nanjing)

Panorama of enterprise power in China SSD industry

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

国内怎么就做不出 IDEA 那样的产品?

ZABBIX monitoring of traditional operation and maintenance (you get up early, I get up early, and we will get together sooner or later)
随机推荐
数据库MySQL语句期末复习 CTGU
架构自治服务:构建数据驱动的架构洞察
CSDN Blogger
阿里云服务器里装的mysql是8版本的,是因为dataworks的mysql驱动版本不支持吗?现在提
几行代码就能实现复杂的 Excel 导入导出,这个工具类真心强大!
Introduction to kubernetes resource object and common commands
kubernetes资源对象介绍及常用命令
Visio use
Architecture autonomy service: building data-driven architecture insight
听说转行软件测试只能自学,培训机构是个坑?
节点基础~节点层级
Pure big resentment! Those who were discouraged from taking the postgraduate entrance examination
Write your own WordPress template
Solve the problem of sqoop error manager SqlManager: Generic SqlManager. listDatabases() not implemented
June 27, 2022 to July 3, 2022 (UE4 video tutorial)
How to upgrade from RHEL 8 to RHEL 9
nuc980心跳灯
oracle cdc 但是使用的服务名没有sid 该怎么配置呢?
CSDN博客专家
DNSLog注入