We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 364c64d commit a0dac32Copy full SHA for a0dac32
climbing-stairs/index.ts
@@ -1,7 +1,12 @@
1
// My code goes here
2
/** https://leetcode-cn.com/problems/climbing-stairs */
3
-export default function climbStairs(n: number): number {
4
- return Number(getClimbStairs(BigInt(n)));
+export default function climbStairs(n: number): number| bigint {
+ const result = getClimbStairs(BigInt(n));
5
+if (result < Number.MAX_SAFE_INTEGER) {
6
+ return Number(result);
7
+ } else {
8
+ return result;
9
+ }
10
}
11
12
function getClimbStairs(num: bigint): bigint {
0 commit comments