hemingqiao 最近的时间轴更新
hemingqiao

hemingqiao

V2EX 第 535509 号会员,加入于 2021-03-02 12:56:26 +08:00
hemingqiao 最近回复了
@billccn 是啊,他贴的这个是有问题的
@samhjn 你跑一下试试呢?我在 leetcode 上的 912 提交通过之后才贴上来的
```
void qsort(vector<int>& arr, int l, int r) {
if (l >= r) return;
int x = arr[l + r >> 1], i = l - 1, j = r + 1;
while (i < j) {
do i++; while (arr[i] < x);
do j--; while (arr[j] > x);
if (i < j) swap(arr[i], arr[j]);
}
qsort(arr, l, j), qsort(arr, j + 1, r);
}
```
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2703 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 14ms · UTC 05:52 · PVG 13:52 · LAX 22:52 · JFK 01:52
Developed with CodeLauncher
♥ Do have faith in what you're doing.