Skip to content

Commit c36a40d

Browse files
authored
Merge pull request gzc426#191 from wswdwf/patch-7
Create Sagittarius.md
2 parents 125a4cd + 6a9af86 commit c36a40d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

2018.12.1-leetcode387/Sagittarius.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
```
2+
class Solution {
3+
public:
4+
int firstUniqChar(string s) {
5+
int a[26]={0};
6+
for(int i=0;i<s.size();i++)
7+
{//cout<<(char)s[i]-'a'<<" ";
8+
a[s[i]-'a']++;
9+
}
10+
for(int i=0;i<s.size();i++)
11+
{
12+
if(a[s[i]-'a']==1)
13+
return i;
14+
}
15+
return -1;
16+
}
17+
};
18+
```

0 commit comments

Comments
 (0)