File tree 3 files changed +67
-0
lines changed
solution/0900-0999/0970.Powerful Integers
3 files changed +67
-0
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,30 @@ class Solution {
99
99
}
100
100
```
101
101
102
+ ### ** JavaScript**
103
+
104
+ ``` js
105
+ /**
106
+ * @param {number} x
107
+ * @param {number} y
108
+ * @param {number} bound
109
+ * @return {number[]}
110
+ */
111
+ var powerfulIntegers = function (x , y , bound ) {
112
+ let res = new Set ();
113
+ for (let i = 1 ; i < bound; i *= x) {
114
+ for (let j = 1 ; j < bound; j *= y) {
115
+ if ((i + j) <= bound) {
116
+ res .add (i + j);
117
+ }
118
+ if (y == 1 ) break ;
119
+ }
120
+ if (x == 1 ) break ;
121
+ }
122
+ return [... res];
123
+ };
124
+ ```
125
+
102
126
### ** ...**
103
127
104
128
```
Original file line number Diff line number Diff line change @@ -91,6 +91,30 @@ class Solution {
91
91
}
92
92
```
93
93
94
+ ### ** JavaScript**
95
+
96
+ ``` js
97
+ /**
98
+ * @param {number} x
99
+ * @param {number} y
100
+ * @param {number} bound
101
+ * @return {number[]}
102
+ */
103
+ var powerfulIntegers = function (x , y , bound ) {
104
+ let res = new Set ();
105
+ for (let i = 1 ; i < bound; i *= x) {
106
+ for (let j = 1 ; j < bound; j *= y) {
107
+ if ((i + j) <= bound) {
108
+ res .add (i + j);
109
+ }
110
+ if (y == 1 ) break ;
111
+ }
112
+ if (x == 1 ) break ;
113
+ }
114
+ return [... res];
115
+ };
116
+ ```
117
+
94
118
### ** ...**
95
119
96
120
```
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @param {number } x
3
+ * @param {number } y
4
+ * @param {number } bound
5
+ * @return {number[] }
6
+ */
7
+ var powerfulIntegers = function ( x , y , bound ) {
8
+ let res = new Set ( ) ;
9
+ for ( let i = 1 ; i < bound ; i *= x ) {
10
+ for ( let j = 1 ; j < bound ; j *= y ) {
11
+ if ( ( i + j ) <= bound ) {
12
+ res . add ( i + j ) ;
13
+ }
14
+ if ( y == 1 ) break ;
15
+ }
16
+ if ( x == 1 ) break ;
17
+ }
18
+ return [ ...res ] ;
19
+ } ;
You can’t perform that action at this time.
0 commit comments