problem
solution
option 1 - recursive
1 | class Solution { |
option 2 - iterative
1 | class Solution { |
analysis
- option 1 - recursive
- time complexity
O(n)
- speed complexity
O(n)
function call
- time complexity
- option 2 - iterative
- time complexity
O(n)
- speed complexity
O(1)
- time complexity