当前位置:网站首页>324. swing sequencing II
324. swing sequencing II
2022-06-28 18:22:00 【anieoo】
Original link :324. Swing sort 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--];
}
}
};边栏推荐
- The fourth column, kubernetes cloud native combat, is coming ~
- WPF video hard decoding, rendering and playing (no airspace) (support 4K, 8K and high frame rate video)
- WSUS client access server exception error -0x8024401f "suggestions collection"
- golang中的select详解(转)
- Google推出Advanced API Security 保护API免受安全威胁
- 使用.NetCore自带的后台作业,出入队简单模拟生产者消费者处理请求响应的数据
- 问下 flink sql cdc. 能同步多张表然后sink到一份表中么 同步的表通过 joi
- 2022A特种设备相关管理(电梯)特种作业证考试题库及在线模拟考试
- [translation] list of Clickhouse 22.4 and 22.5 core features
- Flutter tips: mediaquery and build optimization secrets you don't know
猜你喜欢

Redis 原理 - Hash

DNSLog注入

如何从RHEL 8升级到RHEL 9

Applet graduation project reservation based on wechat housekeeping service applet graduation project opening report function reference

Matlb| visual learning (plot and bar)

MCU modifies network hardware driver (PHY chip replacement)

Applet graduation design based on wechat gym private education appointment applet graduation design opening report function reference

Currency circle earthquake: earned 1million last year and lost 5million this year

Applet graduation design based on wechat conference room reservation applet graduation design opening report function reference

Flutter tips: mediaquery and build optimization secrets you don't know
随机推荐
Would you like to ask for advice on how to open a stock account? Is it safe to open an account online?
Small program graduation project based on wechat recruitment small program graduation project opening report function reference
Redis 原理 - Hash
Advanced C language
Squid proxy server application (I came from afar to make an appointment with you)
NP tips: random create random matrix sample = np random. random([19, 64 , 64, 3])
How to create a CSR (certificate signing request) file?
Spark Tuning (submit job resource parameter tuning)
Ding! Techo day Tencent technology open day arrived as scheduled!
Use PEGA to develop a simple RPA program
Learning notes: how to time 10ms for 51 single chip microcomputer (STC89C52)
[cloud resident co creation] shengteng heterogeneous computing architecture cann helps release the surging computing power of hardware
golang json 序列化、反序列化 字符串反序列化成 map[string]interface{}
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
数字化转型中,企业设备管理会出现什么问题?JNPF或将是“最优解”
kubeadm创建kubernetes集群
WPF video hard decoding, rendering and playing (no airspace) (support 4K, 8K and high frame rate video)
CSDN Blogger
全力冲unreal了
请教大佬们,oracle cdc的NUMBER类型,打印出来为什么变成字符串了呢,怎么转换回去?