1
# Runtime: 189 ms (Top 93.6%) | Memory: 21.09 MB (Top 49.0%)
2

3

4
class Solution:
5
def winnerSquareGame(self, n: int) -> bool:
6
squares = lambda x: (i * i for i in range(isqrt(x), 0, -1))
7

8
@cache
9
def can_win(n: int) -> bool:
10
return n and not all(can_win(n - s) for s in squares(n))
11

12
return can_win(n)

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0