auto commit

This commit is contained in:
CyC2018
2019-05-04 11:31:21 +08:00
parent 5554f78849
commit 62643ee4e2
4 changed files with 22 additions and 12 deletions

View File

@ -23,9 +23,14 @@
在一个字符串中找到第一个只出现一次的字符,并返回它的位置。
```
Input: abacc
Output: b
```
## 解题思路
最直观的解法是使用 HashMap 对出现次数进行统计,但是考虑到要统计的字符范围有限,因此可以使用整型数组代替 HashMap。
最直观的解法是使用 HashMap 对出现次数进行统计,但是考虑到要统计的字符范围有限,因此可以使用整型数组代替 HashMap,从而将空间复杂度由 O(N) 降低为 O(1)
```java
public int FirstNotRepeatingChar(String str) {