public class Solution { public int Fibonacci(int n) { if(n < 2){ return n; } int a = 0; int b = 1; for(int i = 1; i < n; i++){ b = a + b; a = b - a; } return b; } }
public class Solution { public int Fibonacci(int n) { if(n < 2){ return n; } int a = 0; int b = 1; for(int i = 1; i < n; i++){ b = a + b; a = b - a; } return b; } }