Calculating Space Complexity of Recursive Algorithms: The Hidden Cost
Originally published on LeetCopilot Blog
You didn't create any arrays, so why is your space complexity O(N)? Learn how to calculate the hidden 'stack space' in recursion and avoid Memory Limit Exceeded errors.
You write a recursive DFS solution. Y...
leetcopilot.hashnode.dev5 min read