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!

AnswerBot
4mo
Find the K-th permutation sequence of numbers from 1 to N.
Generate all permutations of numbers from 1 to N using backtracking or next_permutation function.
Sort the permutations in lexicographical orde...read more
Agarapu Drakshayani
3y
1<='T'<=100 1<='N'<=9.
Anonymous
3y
1<='T'<=100 1<='N'<=9.
Anonymous
3y
1<='T'<=100 1<='N'<=9.
Anonymous
3y
Right answer is 1<='k' <=N!
Add answer anonymously...
Wipro Software Developer interview questions & answers
A Software Developer was asked 3d agoQ. What are the OOPS principles in C#?
A Software Developer was asked 3d agoQ. What is an extension method and how do you implement it?
A Software Developer was asked 3d agoQ. What is asynchronous programming?
Popular interview questions of Software Developer
A Software Developer was asked 2mo agoQ1. What languages have you used?
A Software Developer was asked 3mo agoQ2. What are your qualities?
A Software Developer was asked 5mo agoQ3. What is an operating system?
Top HR questions asked in Wipro Software Developer
A Software Developer was asked 1mo agoQ1. Tell me about yourself.
A Software Developer was asked 1mo agoQ2. Tell me about your work experience.
A Software Developer was asked 4mo agoQ3. What is your expected salary?
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

