aboutsummaryrefslogtreecommitdiff
path: root/other/fibonacci_number.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'other/fibonacci_number.cpp')
-rw-r--r--other/fibonacci_number.cpp20
1 files changed, 0 insertions, 20 deletions
diff --git a/other/fibonacci_number.cpp b/other/fibonacci_number.cpp
deleted file mode 100644
index 69e46ee..0000000
--- a/other/fibonacci_number.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-#include "leetcode.h"
-
-class Solution {
-public:
- int fib(int n) {
- if (n < 2)
- return n;
- int ans[n + 1];
- ans[0] = 0;
- ans[1] = 1;
- for (int i = 2; i <= n; i++)
- ans[i] = ans[i - 1] + ans[i - 2];
- return ans[n];
- }
-};
-
-int main() {
- Solution obj;
- cout << obj.fib(2);
-}