int thirdMax(vector<int>& nums) {
long long a, b, c;
a = b = c = LLONG_MIN;
for (auto num : nums) {
if (num <= c  num == b  num == a) continue;
c = num;
if (c > b) swap(b, c);
if (b > a) swap(a, b);
}
return c == LLONG_MIN ? a : c;
}
Short Clear C++ solution, no set or pq.

@shawn49 Yes. But man, the case does not exist because the input nums is a vector of int. It can't be LLONG_MIN, which is a long long type.