Shouldn't [1,2,2,5,3,5] return 3 instead of 2?

@coldknight because 5 is already the max, and can't be counted as second or third largest.

@tgreenidge Thank you. It should say the third maximum of distinct numbers.
public int thirdMax(int[] nums) { if(nums==null  nums.length==0) return 0; long first, second, third; first=second=third=Long.MIN_VALUE; for(int num : nums){ if(num==first  num==second  num==third) continue; if(num>first){ third=second; second=first; first=num; }else if(num>second){ third=second; second=num; }else if (num>third){ third=num; } } return third==Long.MIN_VALUE? (int) first: (int) third; }


@deeTEEcee If the third maximum number does not exist, it should return the maximum number. This is clearly stated in the problem description.
