leetcode 387 C++数组做法
生活随笔
收集整理的這篇文章主要介紹了
leetcode 387 C++数组做法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
leetcode 387 C++數組做法
class Solution { public:int firstUniqChar(string s) {int n=s.length();if(n==0) return -1;int table[26]={0};for(int i=0;i!=n;++i){table[s[i]-'a']++;}for(int i=0;i!=n;++i){if(table[s[i]-'a']==1)return i;}return -1;} };END
總結
以上是生活随笔為你收集整理的leetcode 387 C++数组做法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: sql加上唯一索引后批量插入_阿里大佬总
- 下一篇: s3c2440移植MQTT