1
class Solution {
2
public List<Integer> powerfulIntegers(int x, int y, int bound) {
3
HashSet<Integer> set = new HashSet<>();
4
for (int i = 1; i < bound; i *= x) {
5
for (int j = 1; i + j <= bound; j *= y) {
6
set.add(i + j);
7
if (y == 1) break;
8
}
9
if (x == 1) break;
10
}
11
return new ArrayList<>(set);
12
}
13
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0