I read the solution and it saids
Space will be used for the recursion stack O(N).
We also need O(N) for the currentPath.
Since the currentPath is part of the recursion function argument, shouldn’t the Space complexity be
O(N*N) → O(N**2)
Thanks for the help in advance!