namespace Solution
{
public class Fibonacci
{
public static int DoFibonacci(int n)
{
if ("2 1".Contains($"{n}"))
return 1;
return n == 0? 0 : DoFibonacci(n - 1) + DoFibonacci(n - 2);
}
}
}
using NUnit.Framework;
using System;
using Solution;
[TestFixture]
public class SolutionTest
{
[Test]
public void MyTest()
{
Random random = new Random();
int rand = random.Next(75);
Assert.AreEqual(Fib(rand), Fibonacci.DoFibonacci(rand));
}
public static int Fib(int n)
{
if ("2 1".Contains($"{n}"))
return 1;
return n == 0? 0 : Fib(n - 1) + Fib(n - 2);
}
}