summaryrefslogtreecommitdiff
path: root/c/0070/main.c
diff options
context:
space:
mode:
authorMistivia <i@mistivia.com>2025-09-06 23:17:22 +0800
committerMistivia <i@mistivia.com>2025-09-06 23:17:41 +0800
commitad95cba8220e2a7c86362caeb76e1a4333e9c2b8 (patch)
tree30b31d94e2ceb46d4e946bfa1eb88b956508f760 /c/0070/main.c
parent5dd8dcdc2ccfa89d25a3cb342a2f89c644236971 (diff)
refactor
Diffstat (limited to 'c/0070/main.c')
-rw-r--r--c/0070/main.c15
1 files changed, 0 insertions, 15 deletions
diff --git a/c/0070/main.c b/c/0070/main.c
deleted file mode 100644
index 143eeb3..0000000
--- a/c/0070/main.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <stdlib.h>
-
-int climbStairsImpl(int n, int* cache) {
- if (n == 0) return 1;
- if (n < 0) return 0;
- if (cache[n] > 0) return cache[n];
- int ret = climbStairsImpl(n-1, cache) + climbStairsImpl(n-2, cache);
- cache[n] = ret;
- return ret;
-}
-
-int climbStairs(int n) {
- int *cache = malloc(sizeof(int) * (n+1));
- return climbStairsImpl(n, cache);
-}