problem
solution
recursive solution
1 | class Solution { |
i solution
1 | class Solution { |
analysis
- time complexity : could lower to
O(1)
(long long)n * n + (long long)(n - 1) * (n - 1);
- space complexity
O(1)
1 | class Solution { |
1 | class Solution { |
O(1)
(long long)n * n + (long long)(n - 1) * (n - 1);
O(1)