Given an array of positive integers representing the values of coins in your possession, write a function that returns the minimum amount of change (the minimum sum of money) that you CANNOT create. The given coins can have any positive integer value and aren't necessarily unique (i.e., you can have multiple coins of the same value).
coins = [5, 7, 1, 1, 2, 3, 22]
20
{
"coins": [5, 7, 1, 1, 2, 3, 22]
}
20
{
"coins": [1, 1, 1, 1, 1]
}
6
{
"coins": [1, 5, 1, 1, 1, 10, 15, 20, 100]
}
55
Write a function that takes in a non-empty array of integers that are sorted in ascending order and returns a new array of the same length with the squares of the original integers also sorted in ascending order.
array = [1, 2, 3, 5, 6, 8, 9]
[1, 4, 9, 25, 36, 64, 81]
{
"array": [1, 2, 3, 5, 6, 8, 9]
}
[1, 4, 9, 25, 36, 64, 81]
{
"array": [-2, -1]
}
[1, 4]
"array": [-10, -5, 0, 5, 10]
[0, 25, 25, 100, 100]