Saturday, 12 August 2017

CTCI Challange, DAY 17

Day 17

Problem Statement:-Recursion: Fibonacci Numbers

 very simple recursive fibonacci no problem.

Solution:-

   public static int fibonacci(int n) {
        if (n == 0) return 0;
        if (n == 1) return 1;
        return fibonacci(n - 1) + fibonacci(n - 2);
    }

No comments:

Post a Comment

Installing Docker and Minikube

  install docker-   sudo apt install docker.io   set user to docker group:- sudo gpasswd -a   {user} docker   imp commands:- ...