Kim loves making flower arrangements in her free time. One day, she bought a blanket of different
Question:
Kim loves making flower arrangements in her free time. One day, she bought a blanket of different types of flowers from the shops. She has N number of vases at home. Each flower has to be inserted into one of the vases. She wants to arrange the flower so that no more than two flowers of the same type will be inserted in the same vase. She wants to find out which type of flower will be left after her arrangement. Input is two lines. The first line is a list (flower_list) describing which flower types Kim has purchased, with possible types ranging from 1 through 9. There may be more than one of each type. For instance, if the input were "1 1 2 2 2 3", this would suggest that Kim has two flowers of type 1, three flowers of type 2, and one flower of type 3. The second line is the N number of vases she has. Output is a list of integers representing the flower types left (that is, she bought too many). Please sort the output list based on the ascending order of the flower types (For example, [2,3,6,9]). Output empty list [] if no flower is left after the arrangement.
Example input:
1 1 1 1 1 2 3 2 |
Introduction To Materials Management
ISBN: 978-9386873248
8th edition
Authors: Arnold J. R. Tony, Gatewood Ann K., M. Clive Lloyd N. Chapman Stephen