Check If a String Can Break Another String LeetCode solution in Python

1
class Solution:
2
def checkIfCanBreak(self, s1: str, s2: str) -> bool:
3
s1, s2 = sorted(s1), sorted(s2)
4
return all(a1 >= a2 for a1, a2 in zip(s1, s2)) or all(
5
a1 <= a2 for a1, a2 in zip(s1, s2)
6
)

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0