Skip to content

Commit 9b0e0a5

Browse files
committed
Time: 0 ms (100%), Space: 6.4 MB (16.46%) - LeetHub
1 parent edeac1b commit 9b0e0a5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
int dp[(int)1e5];
2+
class Solution {
3+
public:
4+
int fib(int n) {
5+
if(n <= 1)
6+
return n;
7+
if(dp[n]) return dp[n];
8+
return dp[n] = fib(n - 1) + fib(n - 2);
9+
}
10+
};

0 commit comments

Comments
 (0)