解题思路:
单指针,对数组进行两次遍历。
class Solution {public void sortColors(int[] nums) {int p 0;int n nums.length;for (int i 0; i < n; i) {if (nums[i] 0) {int tmp nums[i];nums[i] nums[p];nums[p] tmp;p;}}for (int i p; i …
1、代码如下
//示例函数模板的使用
#include <iostream>
#include <string>
using namespace std;
template <typename T>//函数模板
T max(T a,T b)
{return a>b?a:b;
}
int main()
{int a,b;cout<<"input two integers to a&b:"…
嘿,前端开发达人们!有个超酷的消息要告诉你们:MemFire Cloud来袭啦!这个神奇的东东让你们不用依赖后端小伙伴们,也能妥妥地搞定 API 接口。是不是觉得有点不可思议?但是事实就是这样,让我们一起…