mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
26 lines
733 B
HTML
26 lines
733 B
HTML
<p>给定一个放有字母和数字的数组,找到最长的子数组,且包含的字母和数字的个数相同。</p>
|
|
|
|
<p>返回该子数组,若存在多个最长子数组,返回左端点下标值最小的子数组。若不存在这样的数组,返回一个空数组。</p>
|
|
|
|
<p><strong>示例 1:</strong></p>
|
|
|
|
<pre>
|
|
<strong>输入: </strong>["A","1","B","C","D","2","3","4","E","5","F","G","6","7","H","I","J","K","L","M"]
|
|
|
|
<strong>输出: </strong>["A","1","B","C","D","2","3","4","E","5","F","G","6","7"]
|
|
</pre>
|
|
|
|
<p><strong>示例 2:</strong></p>
|
|
|
|
<pre>
|
|
<strong>输入: </strong>["A","A"]
|
|
|
|
<strong>输出: </strong>[]
|
|
</pre>
|
|
|
|
<p><strong>提示:</strong></p>
|
|
|
|
<ul>
|
|
<li><code>array.length <= 100000</code></li>
|
|
</ul>
|