Bon Appétit
javascript
bill k b return [3, 10, 2, 9] 1 12 5 [3, 10, 2, 9] 1 7 "Bon Appetit"
function bonAppetit(bill, k, b) { let ret = 'Bon Appetit'; const sum = bill.reduce((sum, value, index) => (index != k ? sum + value : sum)) / 2; if (sum != b) ret = b - sum; console.log(ret); }
출처: hackerrank Algorithms, https://www.hackerrank.com/