classSolution: """ @param A: A string @param B: A string @return: if string A contains all of the characters in B return true else return false """ defcompareStrings(self, A, B): # write your code here #此题采用了反向思维的方法,通过举出返回Flase的几种情况后,其余都是True if len(A) < len(B): returnFalse if len(A) == len(B): return(sorted(A) == sorted(B)) for i in B: if A.count(i) < B.count(i): returnFalse returnTrue