Python using collections.Counter


  • 0
    Z

    """

        c = collections.Counter(s)
        for i in range(len(s)):
            if c[s[i]] == 1: return i
        return -1
    

    """


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.