MCPcopy Create free account
hub / github.com/Hsinha11/Leetcode-solutions / Solution

Class Solution

509. Fibonacci/509.fibonacci.cpp:1–19  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1class Solution
2{
3public:
4 int fib(int n)
5 {
6 if (n == 0)
7 {
8 return 0;
9 }
10 else
11 {
12 if (n == 1 || n == 2)
13 {
14 return 1;
15 }
16 return fib(n - 1) + fib(n - 2);
17 }
18 }
19};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected