Skip to content

Instantly share code, notes, and snippets.

View Tshepo-Elifa-Serumula's full-sized avatar
💭
Being.....

Tshepo Elifa Serumula Tshepo-Elifa-Serumula

💭
Being.....
View GitHub Profile
@daubattu
daubattu / hackerrank_solution_of_bon_appétit_in_javascript.js
Created October 26, 2019 06:19
[Hackerrank] Solution of Bon Appétit in JavaScript
function bonAppetit(bill, k, b) {
const sum = bill.reduce((r, v) => r + v, 0);
const result = (sum - bill[k])/2;
if (b - result === 0) console.log('Bon Appetit');
else console.log(b - result);
}