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.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Apply
  • Hiring developers?
  1. Prepare
  2. Functional Programming
  3. Recursion
  4. Fibonacci Numbers
  5. Discussions

Fibonacci Numbers

Problem
Submissions
Leaderboard
Discussions

Sort 57 Discussions, By:

recency

Please Login in order to post a comment

  • francisco
    5 months ago+ 0 comments

    Easy in Haskell

    fib n = fibs !! (n -1) where
        fibs = 0:1:[(a+b)|(a, b) <- zip fibs (tail fibs)]
    
    0|
    Permalink
  • dgd021859
    5 months ago+ 0 comments

    Why utilize this (off-base) decision of records? The Fibonacci numbers should begin with f(0) = 0, f(1) = 1, if by some stroke of good luck for tasteful reasons,monitoredged similar to the gcd-property. Gratitude for the video interface btw.

    0|
    Permalink
  • lematero
    9 months ago+ 0 comments

    F# solution

    open System
    
    let rec f n =
        match n with
        | 1 -> 0
        | 2 -> 1
        | n -> f (n - 1) + f (n - 2)
    
    [<EntryPoint>]
    let main argv =
        Console.ReadLine() |> int |> f |> Console.WriteLine
    
        0
    
    0|
    Permalink
  • tashacourtney
    10 months ago+ 0 comments

    This is a great source here.

    0|
    Permalink
  • manoncamus
    10 months ago+ 0 comments

    I am a new learner here , can you help me.

    0|
    Permalink
Load more conversations

Need Help?


View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy