File tree 1 file changed +0
-26
lines changed
src/main/java/com/fishercoder/solutions
1 file changed +0
-26
lines changed Original file line number Diff line number Diff line change 1
1
package com .fishercoder .solutions ;
2
2
3
- /**
4
- * 414. Third Maximum Number
5
- *
6
- * Given a non-empty array of integers, return the third maximum number in this array.
7
- * If it does not exist, return the maximum number. The time complexity must be in O(n).
8
-
9
- Example 1:
10
- Input: [3, 2, 1]
11
-
12
- Output: 1
13
-
14
- Explanation: The third maximum is 1.
15
- Example 2:
16
- Input: [1, 2]
17
-
18
- Output: 2
19
-
20
- Explanation: The third maximum does not exist, so the maximum (2) is returned instead.
21
- Example 3:
22
- Input: [2, 2, 3, 1]
23
-
24
- Output: 1
25
-
26
- Explanation: Note that the third maximum here means the third maximum distinct number.
27
- Both numbers with value 2 are both considered as second maximum.
28
- */
29
3
public class _414 {
30
4
31
5
public static class Solution1 {
You can’t perform that action at this time.
0 commit comments