I get TLE for 2 test cases

This question is in the recursion section and i get TLE for my code please check.
code- https://ide.codingblocks.com/s/324361

You are taking O(n) time again to check if a permutation is present or not.

Better use a set and improve your time complexity.

1 Like