Back to course home
0% completed
Vote For New Content
The Space Complexity of Brute Force should be O(2^n) like the Time complexity? g...
Michael Shum
Jan 18, 2023
The Space Complexity of Brute Force should be O(2^n) like the Time complexity? given the Space is driven by the # of calls aka the call stack, same as Time complexity
0
0
Comments
Comments
Design Gurus3 years ago
How deep do you think the recursion stack can go? 2^n?
With each recursion call we increment currentIndex by "1". This means that we can't go beyond the size of the array which is 'n'.
In the worst case, when our recursive stack is 'n' step deep, we can have second re...
On this page
Problem Statement
Try it yourself