Skip to content

Commit 5f2c566

Browse files
authored
Create biggest-single-number.sql
1 parent bf3cdf9 commit 5f2c566

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

MySQL/biggest-single-number.sql

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Time: O(n)
2+
# Space: O(n)
3+
4+
SELECT
5+
IFNULL(
6+
(SELECT
7+
MAX(num)
8+
FROM
9+
(SELECT
10+
num
11+
FROM
12+
number
13+
GROUP BY num
14+
HAVING COUNT(num) = 1
15+
ORDER BY NULL) AS t
16+
)
17+
, NULL
18+
) AS num
19+
;

0 commit comments

Comments
 (0)