Ad
Code
Diff
  • interface NthFib {
      static int fib(int n) {
        return (int) Math.round(Math.pow((1+Math.sqrt(5))/2, n) / Math.sqrt(5));
      }
    }
    • interface NthFib {
    • static int fib(int n) {
    • return (int) Math.round(Math.pow(1.61803, n) / 2.236);
    • return (int) Math.round(Math.pow((1+Math.sqrt(5))/2, n) / Math.sqrt(5));
    • }
    • }