剑指offer python版 字符串中第一个只出现一次的字符
def aa(string): if not string: return False hashes={} for s in string: hashes[s]=hashes[s]+1 if hashes.get(s) else 1 for s in string: if hashes[s]==1: return s print(aa("hdahdghshaudiwaig"))
def aa(string): if not string: return False hashes={} for s in string: hashes[s]=hashes[s]+1 if hashes.get(s) else 1 for s in string: if hashes[s]==1: return s print(aa("hdahdghshaudiwaig"))