1449. Form Largest Integer With Digits That Add up to Target
https://leetcode.com/problems/form-largest-integer-with-digits-that-add-up-to-target
Description
Given an array of integers cost
and an integer target
. Return the maximum integer you can paint under the following rules:
The cost of painting a digit (i+1) is given by
cost[i]
(0 indexed).The total cost used must be equal to
target
.Integer does not have digits 0.
Since the answer may be too large, return it as string.
If there is no way to paint any integer given the condition, return "0".
Example 1:
Example 2:
Example 3:
Example 4:
Constraints:
cost.length == 9
1 <= cost[i] <= 5000
1 <= target <= 5000
ac
Previous1448. Count Good Nodes in Binary TreeNext1450. Number of Students Doing Homework at a Given Time
Last updated