Two perfect test case are failing

two perfect test cases are failing in this question
Qprep Concept Recursion : find Kth permutation of sequence

Try This Test cases
18 1172674217


if your answer is correct then might be your failing with the issue of time complexity, if solution is optimized then use long long datatype instead of int in your code to calculate the factorial (if you are using this optimized approach).

Hey @jaypatel did you try what @cipher_3 has suggested you?

Closing this topic as your issue has been resolved by the community. If not Kindly un-mark the accepted solution to re-open the topic or feel free to create a new topic and post a link to this topic as a reference.