Sobes.tech
Middle+

class ATM { public Map<Integer, Integer> withdraw(int amount, String currency) throws Exception { int use = Math.min(need, available); if( use > 0) { result.put(denomination, use); remaining -= denomination*use; } if(remaining != 0) { throw new Exception(); } result.forEach((Integer denomination, Integer count) -> bills.merge(denomination, count, Integer::sum)); return result; } }