We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
It doesnt look so pretty but it works.
I dont understand why I needed to 'hack' this to make it work though, obviously I started with fib 0 and 1 = to 1 but had to 'hack' it since it was off by 2
Haskell:
fib0=0fib1=0fib2=1fib3=1fibn=fib(n-1)+fib(n-2)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Fibonacci Numbers
You are viewing a single comment's thread. Return to all comments →
It doesnt look so pretty but it works. I dont understand why I needed to 'hack' this to make it work though, obviously I started with fib 0 and 1 = to 1 but had to 'hack' it since it was off by 2
Haskell: