1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/只出现一次的最大数字 [biggest-single-number].html
2023-12-09 18:53:53 +08:00

81 lines
1.4 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p><code>MyNumbers</code> 表:</p>
<div class="original__bRMd">
<div>
<pre>
+-------------+------+
| Column Name | Type |
+-------------+------+
| num | int |
+-------------+------+
该表可能包含重复项换句话说在SQL中该表没有主键
这张表的每一行都含有一个整数。
</pre>
<p>&nbsp;</p>
<p><strong>单一数字</strong> 是在 <code>MyNumbers</code> 表中只出现一次的数字。</p>
<p>找出最大的 <strong>单一数字</strong> 。如果不存在 <strong>单一数字</strong> ,则返回&nbsp;<code>null</code></p>
<p>查询结果如下例所示。</p>
<ptable> </ptable>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>
MyNumbers 表:
+-----+
| num |
+-----+
| 8 |
| 8 |
| 3 |
| 3 |
| 1 |
| 4 |
| 5 |
| 6 |
+-----+
<strong>输出:</strong>
+-----+
| num |
+-----+
| 6 |
+-----+
<strong>解释:</strong>单一数字有 1、4、5 和 6 。
6 是最大的单一数字,返回 6 。
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>
MyNumbers table:
+-----+
| num |
+-----+
| 8 |
| 8 |
| 7 |
| 7 |
| 3 |
| 3 |
| 3 |
+-----+
<strong>输出:</strong>
+------+
| num |
+------+
| null |
+------+
<strong>解释:</strong>输入的表中不存在单一数字,所以返回 null 。
</pre>
</div>
</div>
<p>&nbsp;</p>