1
class Solution:
2
def isSelfCrossing(self, x):
3
n = len(x)
4
if n < 4:
5
return False
6
for i in range(3, n):
7
if x[i] >= x[i - 2] and x[i - 1] <= x[i - 3]:
8
return True
9
if i >= 4 and x[i - 1] == x[i - 3] and x[i] + x[i - 4] >= x[i - 2]:
10
return True
11
if (
12
i >= 5
13
and 0 <= x[i - 2] - x[i - 4] <= x[i]
14
and 0 <= x[i - 3] - x[i - 1] <= x[i - 5]
15
):
16
return True
17
return False

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0