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)/找出数组中的第 K 大整数 [find-the-kth-largest-integer-in-the-array].html
2022-03-29 12:43:11 +08:00

49 lines
1.6 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>nums</code> 和一个整数 <code>k</code><code>nums</code> 中的每个字符串都表示一个不含前导零的整数。</p>
<p>返回 <code>nums</code> 中表示第 <code>k</code> 大整数的字符串。</p>
<p><strong>注意:</strong>重复的数字在统计时会视为不同元素考虑。例如,如果 <code>nums</code><code>["1","2","2"]</code>,那么 <code>"2"</code> 是最大的整数,<code>"2"</code> 是第二大的整数,<code>"1"</code> 是第三大的整数。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>nums = ["3","6","7","10"], k = 4
<strong>输出:</strong>"3"
<strong>解释:</strong>
nums 中的数字按非递减顺序排列为 ["3","6","7","10"]
其中第 4 大整数是 "3"
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>nums = ["2","21","12","1"], k = 3
<strong>输出:</strong>"2"
<strong>解释:</strong>
nums 中的数字按非递减顺序排列为 ["1","2","12","21"]
其中第 3 大整数是 "2"
</pre>
<p><strong>示例 3</strong></p>
<pre>
<strong>输入:</strong>nums = ["0","0"], k = 2
<strong>输出:</strong>"0"
<strong>解释:</strong>
nums 中的数字按非递减顺序排列为 ["0","0"]
其中第 2 大整数是 "0"
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= k &lt;= nums.length &lt;= 10<sup>4</sup></code></li>
<li><code>1 &lt;= nums[i].length &lt;= 100</code></li>
<li><code>nums[i]</code> 仅由数字组成</li>
<li><code>nums[i]</code> 不含任何前导零</li>
</ul>