public class Solution {
    public int Fibonacci(int n) {
        if (n <= 0) {
            return 0;
        }
        if (n == 1 || n == 2) {
            return 1;
        }
        int a = 1, b = 1;
        int k = 3;
        int result = 0;
        while(k <= n){
            result = a + b;
            a = b;
            b = result;
            k ++;
        }
        return result;

    }
    public int f2(int n) {
        if (n <= 0 ) {
            return 0;
        }
        if (n == 1  || n == 2) {
            return 1;
        }
        return f2(n - 1) + f2(n - 2);
    }
}