The time complexity is the same. In fact, I would be surprised if someone came up with a better complexity for a permutation problem where we have to list all permutations. So I tried to optimize it elsewhere, i.e. space complexity and a bit of performance. I generally think it's a good approach to use fixed sized arrays where possible. It looks much cleaner than Objects, StringBuilders etc. and has better performance. Java folk like me are too used to using Java libraries, it's sometimes useful to take inspiration from C and explicit memory management.