Largest 3-Same-Digit Number in String LeetCode solution in Python

1
class Solution:
2
def largestGoodInteger(self, n: str) -> str:
3
return max(
4
n[i - 2 : i + 1] if n[i] == n[i - 1] == n[i - 2] else ""
5
for i in range(2, len(n))
6
)

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0