1
from math import log
2

3

4
class Solution:
5
def powerfulIntegers(self, x: int, y: int, bound: int) -> List[int]:
6
if bound == 0:
7
return []
8
maxi = int(log(bound, max(x, 2))) + 1
9
maxj = int(log(bound, max(y, 2))) + 1
10
L = set()
11
for i in range(maxi):
12
for j in range(maxj):
13
if (t := x**i + y**j) <= bound:
14
L.add(t)
15
else:
16
break
17
return list(L)

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0