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   ·   实用小工具   ·   6135 人在线   最高记录 6547   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 17ms · UTC 06:21 · PVG 14:21 · LAX 23:21 · JFK 02:21
Developed with CodeLauncher
♥ Do have faith in what you're doing.