ways to represent a number as sum of 1's and 2's
// The number of ways to represent a number with only 1s and 2s is
// equal to (n+1)th fibonacci number
public static int nthFibonacciNumber(int n) {
int[] arr = new int[n+2];
arr[0] = 0;
arr[1] = 1;
for(int i = 2; i <= n; i++) {
arr[i] = arr[i - 1] + arr[i -2];
}
return arr[n];
}