Skip to content

Commit 026da34

Browse files
committed
2020-02-12
1 parent 5c72180 commit 026da34

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
class Solution(object):
2+
def checkIfExist(self, arr):
3+
"""
4+
:type arr: List[int]
5+
:rtype: bool
6+
"""
7+
if arr.count(0) > 1:
8+
return True
9+
10+
arr = set(arr) - set([0])
11+
12+
for x in arr:
13+
if x * 2 in arr:
14+
return True
15+
16+
return False
17+
18+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Solution(object):
2+
def minSteps(self, s, t):
3+
"""
4+
:type s: str
5+
:type t: str
6+
:rtype: int
7+
"""
8+
n = len(t)
9+
from collections import Counter
10+
dic1 = Counter(s)
11+
dic2 = Counter(t)
12+
13+
valid = 0
14+
for char, fre in dic2.items():
15+
valid += min(dic1[char], fre)
16+
17+
return n - valid

0 commit comments

Comments
 (0)