File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 1
1
// My code goes here
2
2
/** https://leetcode-cn.com/problems/climbing-stairs */
3
- export default function climbStairs ( n : number ) : number | bigint {
4
- const result = getClimbStairs ( BigInt ( n ) ) ;
5
- if ( result < Number . MAX_SAFE_INTEGER ) {
3
+ export default function climbStairs ( n : number ) : number | bigint {
4
+ const result = getClimbStairs ( BigInt ( n ) ) ;
5
+ if ( result < Number . MAX_SAFE_INTEGER ) {
6
6
return Number ( result ) ;
7
7
} else {
8
8
return result ;
Original file line number Diff line number Diff line change @@ -2,12 +2,15 @@ import { assertStrictEquals } from "../deps.ts";
2
2
import { climbStairs } from "../mod.ts" ;
3
3
4
4
Deno . test ( "climbing-stairs" , ( ) => {
5
- const examples : { input : number ; output : ReturnType < typeof climbStairs > ; } [ ] = [
5
+ const examples : {
6
+ input : number ;
7
+ output : ReturnType < typeof climbStairs > ;
8
+ } [ ] = [
6
9
{ input : 10 , output : 89 } ,
7
10
{ input : 1 , output : 1 } ,
8
11
{ input : 2 , output : 2 } ,
9
12
{ input : 3 , output : 3 } ,
10
- { input : 99 , output : 354224848179261915075n } ,
13
+ { input : 99 , output : 354224848179261915075n } ,
11
14
] ;
12
15
examples . forEach ( ( { input, output } ) => {
13
16
assertStrictEquals ( climbStairs ( input ) , output ) ;
You can’t perform that action at this time.
0 commit comments