Given N coins and an int array costs of representing the cost of each digit (1...9), where costs[i] is the cost of picking i. Find the largest number that can be represented by using the N coins.
Examples
Input: N = 5, costs = [12, 3, 5, 1, 2, 6, 8, 9, 1]
Output: 99999
Explanation: 9 costs 1 coin to use, hence with 5 coins we can pick 9, 5 times.
Input: N = 2, costs = [11, 13, 2, 2, 3, 5, 4, 8, 6, 10, 7]
Output: 4
Explanation: 4 costs 2 coin to use, hence with 2 coins we can pick 4, 1 time.
Input: N = 5, costs = [9, 9, 9, 9, 9, 9, 9, 9, 9]
Output: -1
Explanation: No number can be formed from 5 coins, hence print -1;Constraints
sizeof(costs) = 9
1 <= T <= 10^3
1 <= N <= 10^3
1 <= costs[i] <= 10^3