Skip to content

Commit 0332026

Browse files
committed
Runtime: 303 ms (Top 21.43%) | Memory: 21.30 MB (Top 33.04%)
1 parent 8374207 commit 0332026

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Runtime: 303 ms (Top 21.43%) | Memory: 21.30 MB (Top 33.04%)
2+
3+
class Solution:
4+
def canChange(self, A: str, B: str) -> bool:
5+
P = lambda c : c != '_'
6+
I = lambda s,x : [i for i,c in enumerate(s) if c==x]
7+
G = lambda d,p : all( p(x,y) for x,y in zip( I(A,d), I(B,d) ) )
8+
S = lambda : [*filter(P,A)] == [*filter(P,B)]
9+
return S() and G('L', ge) and G('R', le)
10+
# 1. 2. 3.

0 commit comments

Comments
 (0)