[剑指offer 编程题]字符流中第一个不重复的字符

字符流中第一个不重复的字符

http://www.nowcoder.com/questionTerminal/00de97733b8e4f97a3fb5c680ee10720

class Solution
{
public:
  //Insert one char from stringstream
    void Insert(char ch)
    {
         s += ch;
    }
  //return the first appearence once char in current stringstream
    char FirstAppearingOnce()
    {
         for(int i=0;i<s.length();i++){
             if(count(s.begin(),s.end(),s[i]) == 1)return s[i];
         }

        return '#';
    }

private:
    string s = "";

};
全部评论
你这时间查找的复杂度太高了吧?
点赞 回复 分享
发布于 2019-11-17 22:38

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务