Pastebin
API
tools
faq
paste
Login
Sign up
SHARE
TWEET
Fibonacci
vaibhav1906
Dec 18th, 2021
1,528
0
Never
Add comment
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!
C++
0.28 KB
| None
|
0
0
raw
download
clone
embed
print
report
class
Solution
{
public
:
int
f
(
int
n
)
{
if
(
n
==
0
)
return
0
;
if
(
n
==
1
)
return
1
;
return
f
(
n
-
1
)
+
f
(
n
-
2
)
;
}
int
fib
(
int
n
)
{
int
ans
=
f
(
n
)
;
return
ans
;
}
}
;
Advertisement
Add Comment
Please,
Sign In
to add comment
Public Pastes
OoT rando seed 4/18
5 min ago | 67.81 KB
Untitled
49 min ago | 8.94 KB
Untitled
2 hours ago | 8.56 KB
Untitled
4 hours ago | 14.18 KB
Untitled
6 hours ago | 14.46 KB
Untitled
8 hours ago | 14.10 KB
Untitled
10 hours ago | 12.82 KB
Untitled
12 hours ago | 15.05 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!