Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save daubattu/2157a3208045adf32094e055e4931f95 to your computer and use it in GitHub Desktop.
Save daubattu/2157a3208045adf32094e055e4931f95 to your computer and use it in GitHub Desktop.
[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);
}
@Tshepo-Elifa-Serumula
Copy link

Thanks

@Khadaro
Copy link

Khadaro commented Aug 3, 2022

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment