-
Notifications
You must be signed in to change notification settings - Fork 0
/
771
31 lines (23 loc) · 771 Bytes
/
771
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
First day practice at: https://leetcode.com/problems/jewels-and-stones/description/
class Solution(object):
def numJewelsInStones(self, J, S):
"""
:type J: str
:type S: str
:rtype: int
"""
count = 0
list_jew = []
list_me = []
for i in range(len(J)):
list_jew.append(J[i])
for j in range(len(S)):
list_me.append(S[j])
# print list_jew
# print list_me
for item in list_me:
if item in list_jew:
count += 1
# print count
return count
should have noticed that strings could not be iterated using "item in string blah blah"