File tree Expand file tree Collapse file tree 4 files changed +21
-21
lines changed
solution/0900-0999/0967.Numbers With Same Consecutive Differences Expand file tree Collapse file tree 4 files changed +21
-21
lines changed Original file line number Diff line number Diff line change @@ -182,12 +182,12 @@ func numsSameConsecDiff(n int, k int) []int {
182
182
183
183
``` ts
184
184
function numsSameConsecDiff(n : number , k : number ): number [] {
185
- const res = new Set <number >();
185
+ const ans = new Set <number >();
186
186
const boundary = 10 ** (n - 1 );
187
187
188
188
const dfs = (nums : number ) => {
189
189
if (nums >= boundary ) {
190
- res .add (nums );
190
+ ans .add (nums );
191
191
return ;
192
192
}
193
193
@@ -203,20 +203,20 @@ function numsSameConsecDiff(n: number, k: number): number[] {
203
203
dfs (i );
204
204
}
205
205
206
- return [... res ];
206
+ return [... ans ];
207
207
}
208
208
```
209
209
210
210
#### JavaScript
211
211
212
- ``` ts
212
+ ``` js
213
213
function numsSameConsecDiff (n , k ) {
214
- const res = new Set ();
214
+ const ans = new Set ();
215
215
const boundary = 10 ** (n - 1 );
216
216
217
217
const dfs = nums => {
218
218
if (nums >= boundary) {
219
- res .add (nums );
219
+ ans .add (nums);
220
220
return ;
221
221
}
222
222
@@ -232,7 +232,7 @@ function numsSameConsecDiff(n, k) {
232
232
dfs (i);
233
233
}
234
234
235
- return [... res ];
235
+ return [... ans ];
236
236
}
237
237
```
238
238
Original file line number Diff line number Diff line change @@ -165,12 +165,12 @@ func numsSameConsecDiff(n int, k int) []int {
165
165
166
166
``` ts
167
167
function numsSameConsecDiff(n : number , k : number ): number [] {
168
- const res = new Set <number >();
168
+ const ans = new Set <number >();
169
169
const boundary = 10 ** (n - 1 );
170
170
171
171
const dfs = (nums : number ) => {
172
172
if (nums >= boundary ) {
173
- res .add (nums );
173
+ ans .add (nums );
174
174
return ;
175
175
}
176
176
@@ -186,20 +186,20 @@ function numsSameConsecDiff(n: number, k: number): number[] {
186
186
dfs (i );
187
187
}
188
188
189
- return [... res ];
189
+ return [... ans ];
190
190
}
191
191
```
192
192
193
193
#### JavaScript
194
194
195
195
``` js
196
- function numsSameConsecDiff (n : number , k : number ): number[] {
197
- const res = new Set < number > ();
196
+ function numsSameConsecDiff (n , k ) {
197
+ const ans = new Set ();
198
198
const boundary = 10 ** (n - 1 );
199
199
200
- const dfs = ( nums : number ) => {
200
+ const dfs = nums => {
201
201
if (nums >= boundary) {
202
- res .add (nums);
202
+ ans .add (nums);
203
203
return ;
204
204
}
205
205
@@ -215,7 +215,7 @@ function numsSameConsecDiff(n: number, k: number): number[] {
215
215
dfs (i);
216
216
}
217
217
218
- return [... res ];
218
+ return [... ans ];
219
219
}
220
220
```
221
221
Original file line number Diff line number Diff line change 1
1
function numsSameConsecDiff ( n , k ) {
2
- const res = new Set ( ) ;
2
+ const ans = new Set ( ) ;
3
3
const boundary = 10 ** ( n - 1 ) ;
4
4
5
5
const dfs = nums => {
6
6
if ( nums >= boundary ) {
7
- res . add ( nums ) ;
7
+ ans . add ( nums ) ;
8
8
return ;
9
9
}
10
10
@@ -20,5 +20,5 @@ function numsSameConsecDiff(n, k) {
20
20
dfs ( i ) ;
21
21
}
22
22
23
- return [ ...res ] ;
23
+ return [ ...ans ] ;
24
24
}
Original file line number Diff line number Diff line change 1
1
function numsSameConsecDiff ( n : number , k : number ) : number [ ] {
2
- const res = new Set < number > ( ) ;
2
+ const ans = new Set < number > ( ) ;
3
3
const boundary = 10 ** ( n - 1 ) ;
4
4
5
5
const dfs = ( nums : number ) => {
6
6
if ( nums >= boundary ) {
7
- res . add ( nums ) ;
7
+ ans . add ( nums ) ;
8
8
return ;
9
9
}
10
10
@@ -20,5 +20,5 @@ function numsSameConsecDiff(n: number, k: number): number[] {
20
20
dfs ( i ) ;
21
21
}
22
22
23
- return [ ...res ] ;
23
+ return [ ...ans ] ;
24
24
}
You can’t perform that action at this time.
0 commit comments