1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/字符串中的第一个唯一字符 [first-unique-character-in-a-string].html
2022-03-29 12:43:11 +08:00

34 lines
726 B
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>给定一个字符串&nbsp;<code>s</code>&nbsp;,找到 <em>它的第一个不重复的字符,并返回它的索引</em> 。如果不存在,则返回 <code>-1</code>&nbsp;</p>
<p>&nbsp;</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>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= s.length &lt;= 10<sup>5</sup></code></li>
<li><code>s</code>&nbsp;只包含小写字母</li>
</ul>