mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
34 lines
726 B
HTML
34 lines
726 B
HTML
<p>给定一个字符串 <code>s</code> ,找到 <em>它的第一个不重复的字符,并返回它的索引</em> 。如果不存在,则返回 <code>-1</code> 。</p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong> s = "leetcode"
|
||
<strong>输出:</strong> 0
|
||
</pre>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong> s = "loveleetcode"
|
||
<strong>输出:</strong> 2
|
||
</pre>
|
||
|
||
<p><strong>示例 3:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong> s = "aabb"
|
||
<strong>输出:</strong> -1
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li><code>1 <= s.length <= 10<sup>5</sup></code></li>
|
||
<li><code>s</code> 只包含小写字母</li>
|
||
</ul>
|