597. Super Ugly Number
A super ugly number is a positive integer that has prime factors from the array primes. Given an integer n and an array of integers primes, find and print the nth super ugly number. The nth super ugly number will be within the range of a 32-bit signed integer.
The first line contains the value of n. The second line contains the size of the primes array. The third line contains the elements of the primes array.
An integer representing the nth super ugly number.
12 4 2 7 13 19
1 <= n <= 10^5 1 <= primes.length <= 100 2 <= primes[i] <= 1000 primes[i] is a prime number. All values of primes are unique and sorted in ascending order.