Search⌘ K
AI Features

Solution: Third Maximum Number

Solution: Third Maximum Number asks you to find the third distinct maximum value in an integer array, or return the overall maximum when fewer than three distinct values exist.

Statement

Given an integer array nums, determine and return the third distinct maximum element in the array. If the array contains fewer than three distinct elements, return the maximum element instead.

Constraints:

  • 1<=1 <= ...