What is wrong with that linear thing??
package com.codegym.task.task39.task3904;
import java.util.Arrays;
/*
Stairs
*/
public class Solution {
private static int n = 70;
public static void main(String[] args) {
System.out.println("The number of possible ascents for " + n + " steps is: " + numberOfPossibleAscents(n));
}
public static long numberOfPossibleAscents(int n) {
if (n == 0) return 1;
else if (n < 0) return 0;
int a = 1;
int b = 1;
int c = 2;
for (int i = 3; i <= n; i++)
{
int result = a + b + c;
a = b;
b = c;
c = result;
}
return c;
}
}