Solution 1: time limit exceeded
Time: O(2^n)
I forget to remove “static” on ways and it accumulates the results of all test cases.
|
|
A better alternative
|
|
Solution 2: accepted 0ms
Time: O(n)
Straight fibonacci: f(n) = f(n-1) + f(n-2)
|
|
Time: O(2^n)
I forget to remove “static” on ways and it accumulates the results of all test cases.
|
|
A better alternative
|
|
Time: O(n)
Straight fibonacci: f(n) = f(n-1) + f(n-2)
|
|