1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-13 19:31:42 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

add leetcode problem-cn part1

This commit is contained in:
2022-03-27 20:37:52 +08:00
parent 8e542045d1
commit c554fc6908
1285 changed files with 108123 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<p>给你一个整数数组 <code>arr</code> 和一个整数 <code>k</code> 。现需要从数组中恰好移除 <code>k</code> 个元素,请找出移除后数组中不同整数的最少数目。</p>
<ol>
</ol>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>arr = [5,5,4], k = 1
<strong>输出:</strong>1
<strong>解释:</strong>移除 1 个 4 ,数组中只剩下 5 一种整数。
</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>arr = [4,3,1,1,3,3,2], k = 3
<strong>输出:</strong>2
<strong>解释:</strong>先移除 4、2 ,然后再移除两个 1 中的任意 1 个或者三个 3 中的任意 1 个,最后剩下 1 和 3 两种整数。</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= arr.length&nbsp;&lt;= 10^5</code></li>
<li><code>1 &lt;= arr[i] &lt;= 10^9</code></li>
<li><code>0 &lt;= k&nbsp;&lt;= arr.length</code></li>
</ul>