//vs中运行失败,网页上提交是OK的,还未解决 。
#include <iostream>
#include <algorithm>
#include "vector"
#include "string"
#include "set"
#include "unordered_map"
#include "queue"
#include "stack"
using namespace std;
int thirdMax(vector<int>& nums)
{
sort(nums.begin(), nums.end(), greater<int>());//vs中运行失败,网页上提交是OK的
vector<int>::iterator iter = unique(nums.begin(), nums.end());
nums.erase(iter, nums.end());
if (nums.size() < 3)
{
return nums[0];
}
return nums[2];
}
int main()
{
vector<int>v;
v.push_back(3);
v.push_back(2);
v.push_back(1);
cout << thirdMax(v);
system("pause");
return 0;
}