We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
public static void bonAppetit(List<Integer> bill, int k, int b) {
int supposedSum = 0;
for(int i=0;i<bill.size();i++) {
if(i!=k) supposedSum += bill.get(i);
}
int supposedPaid = supposedSum/2;
if(supposedPaid == b) System.out.println("Bon Appetit");
else {
int toRefund = b-supposedPaid;
System.out.println(toRefund);
}
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Bill Division
You are viewing a single comment's thread. Return to all comments →