int thirdMax(vector<int>& nums) {

```
int a = INT_MIN;
int b = INT_MIN;
int c = INT_MIN;
int min = INT_MAX;
for(auto n: nums) {
if(n > a) {
c = b;
b = a;
a = n;
} else if(n > b && n < a) {
c = b ;
b = n;
} else if(n > c && n < b) {
c = n;
}
if(n < min)
min = n;
}
return (min <= c && b > c)? c: a;
```

}