Category: Hackerrank

13
Jan
2020

Hackerrank Electronic Shop (C++)

C++ : Explanation: This one is simple. Simply do a nested for loop to loop through all the prices combination of keyboard and drives. Set the amountSpent to -1 if it’s over the...

11
Jan
2020

Hackerrank Sock Merchant (C++)

C++ : Explanation: Sort the socks with sort(). (Try saying this 10 times quickly.) The for loop finds pairs of socks with the same numbers, and add 1 to noOfSockPairs each time a...

11
Jan
2020

Hackerrank Bon Appétit (C++)

C++ : Explanation: The for loop sums up all elements of the vector bill except the element at k and put it in billToSplit. billToSplit is then divided by Brian and Anna. After...