标签:return int std code stun i++ cte fir class
1 static int wing=[]() 2 { 3 std::ios::sync_with_stdio(false); 4 cin.tie(NULL); 5 return 0; 6 }(); 7 8 class Solution 9 { 10 public: 11 int firstUniqChar(string s) 12 { 13 vector<int> vi(128,0); 14 for(char c : s) 15 vi[c]++; 16 int len=s.length(); 17 for(int i=0;i<len;i++) 18 if(vi[s[i]]==1) 19 return i; 20 return -1; 21 } 22 };
仍然是可以用map,也可以用vector,随意
387. First Unique Character in a String
标签:return int std code stun i++ cte fir class
原文地址:https://www.cnblogs.com/zhuangbijingdeboke/p/9093884.html