Hackerrank's Problem Solving solutions( Bill Division, Sales by Match, Drawing Book ) :
Problem 19: Bill Division Solution: (in c++) ( please guys before moving to the solution try it yourself at least 3-4 times , if you really wanna become a good coder) #include< bits/stdc++.h > using namespace std ; int main () { long long n , k , i , b , sum = 0 , unfair , fair , refund ; cin >> n >> k ; long long bill [ n ]; for ( i = 0 ; i < n ; i ++) { cin >> bill [ i ]; sum = sum + bill [ i ]; } cin >> b ; unfair = sum / 2 ; fair =( sum - bill [ k ])/ 2 ; refund = unfair - fair ; if ( b == fair ) { cout << "Bon Appetit" ; } else { cout << refund ; } } This code is simple. There's no need for any explanation. Problem 20: Sales by Match Solution: (in c++) ( please guys before moving to the solution try it yourself at least 3-4 times , if you really wanna become a good coder) #include< bits/stdc++.h > using namespace st