0313. Super Ugly Number
https://leetcode.com/problems/super-ugly-number
Description
A super ugly number is a positive integer whose prime factors are in the array primes
.
Given an integer n
and an array of integers primes
, return the nth
super ugly number.
The nth
super ugly number is guaranteed to fit in a 32-bit signed integer.
Example 1:
Example 2:
Constraints:
1 <= n <= 106
1 <= primes.length <= 100
2 <= primes[i] <= 1000
primes[i]
is guaranteed to be a prime number.All the values of
primes
are unique and sorted in ascending order.
ac
Last updated