I know the solution below is sub-optimal, but would appreciate a second pair of eyes on big-O
Let N = s.length(), worst case is: O(N!) time and O(N) extra space (for call stack). Do you agree?
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.