python解法

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

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

class Solution:
    # 返回对应char
    def __init__(self):
        self.s=''
    def FirstAppearingOnce(self):
        # write code here
        res=[]
        for i in self.s:
            if i in res:
                res.remove(i)
            else:
                res.append(i)
        return res[0] if res else "#"
    def Insert(self, char):
        # write code here
        self.s+=char

全部评论
如果输入是gooogle的话,你这个是不是返回‘o’?
2 回复 分享
发布于 2020-07-24 23:41
你这答案有问题吧
点赞 回复 分享
发布于 2021-06-19 15:05

相关推荐

07-15 14:14
门头沟学院 Java
7.10投递7.15感谢信
投递地平线等公司7个岗位
点赞 评论 收藏
分享
06-28 22:48
已编辑
广东金融学院 Java
小浪_Coding:学院本+这俩项目不是buff叠满了嘛
点赞 评论 收藏
分享
评论
4
收藏
分享

创作者周榜

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