Leetcode 387. First Unique Character in a String

送分题

class Solution(object):
    def firstUniqChar(self, s):
        """
        :type s: str
        :rtype: int
        """
        count=collections.Counter(s)
        for i,v in enumerate(s):
            if count[v]==1:
                return i
        return -1
        

 

posted @ 2019-03-20 07:28  周洋  阅读(104)  评论(0编辑  收藏  举报