K-th Ugly Ninja Problem Statement
Ninja is looking to hire 'ugly ninjas' whose numbers have all prime factors from a given list. Your task is to help him find the K-th ugly ninja.
You will be given an array PRIME_ARR
containing prime integers and an integer K
.
Example:
Input:
PRIME_ARR = [2, 7, 13, 19], K = 12
Output:
32
Explanation:
First 12 ugly numbers are { 1, 2, 4, 7, 8, 13, 14, 16, 19, 26, 28, 32 } derived using the primes in PRIME_ARR
.
Constraints:
1 <= T <= 50
1 <= N <= 100
1 <= K <= 10^3
1 <= PRIME_ARR[i] <= 1000
- Time Limit: 1sec
Be the first one to answer
Add answer anonymously...
Top MathWorks Software Developer Intern interview questions & answers
Popular interview questions of Software Developer Intern
>
MathWorks Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
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
Get AmbitionBox app