about | help | code help+videos | done | prefs |
Given a String array of items and an integer array of quantities, create a TreeMap that uses Strings for keys and integers for values that contains all of the arrays contents, and then return a String using the following formatting. "I need to buy QTY ITEM, QTY ITEM, ..., and QTY ITEM." Where QTY is the quantity and ITEM is the item name. If the QTY is more than 1, the ITEM should be plural. The word "and" should only come before the last QTY ITEM. welcomeback_map_needToBuy(["apple", "banana"], [3, 5]) → "I need to buy 3 apples, and 5 bananas." welcomeback_map_needToBuy(["apple", "carrot", "banana"], [3, 1, 5]) → "I need to buy 3 apples, 5 bananas, and 1 carrot." welcomeback_map_needToBuy(["banana"], [5]) → "I need to buy 5 bananas." ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Copyright Nick Parlante 2017 - privacy