1
class Solution {
2
public:
3
vector<int> powerfulIntegers(int x, int y, int bound) {
4
unordered_set<int> s;
5

6
for (int i = 0; pow(x, i) <= bound; i++) {
7
for (int j = 0; pow(x, i) + pow(y, j) <= bound; j++) {
8
s.insert(pow(x, i) + pow(y, j));
9
if (y == 1) break;
10
}
11
if (x == 1) break;
12
}
13
return vector<int>(s.begin(), s.end());
14
}
15
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0