K-th Permutation Sequence Problem Statement

Given two integers N and K, your task is to find the K-th permutation sequence of numbers from 1 to N. The K-th permutation is the K-th permutation in the set of all sorted permutations of numbers from 1 to N.

Example:

Input:
N = 3, K = 4
Output:
"231"
Explanation:

The permutations of 1, 2, and 3 in order are “123”, “132”, “213”, “231”, “312”, “321”. Thus, the 4-th permutation is “231”.

Constraints:

  • 1 <= T <= 100
  • 1 <= N <= 9
  • 1 <= K <= N!
Agarapu Drakshayani
2y

1<='T'<=100 1<='N'<=9.

Anonymous
2y

1<='T'<=100 1<='N'<=9.

Anonymous
2y

1<='T'<=100 1<='N'<=9.

Anonymous
2y

Right answer is 1<='k'  <=N! 

Add answer anonymously...
Wipro Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter