Class Solution
java.lang.Object
g0901_1000.s0970_powerful_integers.Solution
970 - Powerful Integers.<p>Medium</p>
<p>Given three integers <code>x</code>, <code>y</code>, and <code>bound</code>, return <em>a list of all the <strong>powerful integers</strong> that have a value less than or equal to</em> <code>bound</code>.</p>
<p>An integer is <strong>powerful</strong> if it can be represented as <code>x<sup>i</sup> + y<sup>j</sup></code> for some integers <code>i >= 0</code> and <code>j >= 0</code>.</p>
<p>You may return the answer in <strong>any order</strong>. In your answer, each value should occur <strong>at most once</strong>.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> x = 2, y = 3, bound = 10</p>
<p><strong>Output:</strong> [2,3,4,5,7,9,10]</p>
<p><strong>Explanation:</strong></p>
<p>2 = 2<sup>0</sup> + 3<sup>0</sup></p>
<p>3 = 2<sup>1</sup> + 3<sup>0</sup></p>
<p>4 = 2<sup>0</sup> + 3<sup>1</sup></p>
<p>5 = 2<sup>1</sup> + 3<sup>1</sup></p>
<p>7 = 2<sup>2</sup> + 3<sup>1</sup></p>
<p>9 = 2<sup>3</sup> + 3<sup>0</sup></p>
<p>10 = 2<sup>0</sup> + 3<sup>2</sup></p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> x = 3, y = 5, bound = 15</p>
<p><strong>Output:</strong> [2,4,6,8,10,14]</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= x, y <= 100</code></li>
<li><code>0 <= bound <= 10<sup>6</sup></code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
powerfulIntegers
-