Super Ugly Number
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
A **super ugly number** is a positive integer whose prime factors all come from a given list primes. The number
1 counts as super ugly for every list.
Given n and the sorted list of distinct primes primes, return the n-th super ugly number in ascending order
(1-indexed, so n = 1 returns 1). The answer is guaranteed to fit in a signed 32-bit integer.
Examples
Constraints
- 1 <= n <= 10^5
- 1 <= primes.length <= 100
- 2 <= primes[i] <= 1000
- `primes` contains distinct primes sorted in ascending order
- The n-th super ugly number fits in a signed 32-bit integer
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.