We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b2c14b2 commit fc11a58Copy full SHA for fc11a58
compare_strings.py
@@ -0,0 +1,24 @@
1
+# -*- coding: utf-8 -*-
2
+
3
+class Solution:
4
+ """
5
+ @param A : A string includes Upper Case letters
6
+ @param B : A string includes Upper Case letters
7
+ @return : if string A contains all of the characters in B return True else return False
8
9
+ def compareStrings(self, A, B):
10
+ # write your code here
11
+ if not B:
12
+ return True
13
+ count = {}
14
+ for i, ch in enumerate(B):
15
+ if ch not in count:
16
+ count[ch] = 1
17
+ else:
18
+ count[ch] += 1
19
+ for i, ch in enumerate(A):
20
+ if ch in count:
21
+ count[ch] -= 1
22
+ if count[ch] == 0:
23
+ del(count[ch])
24
+ return not count
0 commit comments