Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution:
- """
- @param A: A string
- @param B: A string
- @return: if string A contains all of the characters in B return true else return false
- """
- def compareStrings(self, A, B):
- # write your code here
- la = len(A)
- lb = len(B)
- if la < lb:
- return False
- if lb==0:
- return True
- sA = sorted (A)
- sB = sorted (B)
- i = 0
- j = 0
- while True:
- if j>(lb-1):
- return True
- if i>(la-1):
- return False
- if sA[i]==sB[j]:
- i+=1
- j+=1
- else:
- if sA[i] > sB[j]:
- return False
- else:
- i+=1
Add Comment
Please, Sign In to add comment