Hackerrank Jumping on the Clouds: Revisited (C++)
C++ : Explanation: Note: Test case 8 (Test case 1 in Run Code, Test case 8 in Submit Code) is bugged! I spend hours trying to cater to test case 8 but to...
C++ : Explanation: Note: Test case 8 (Test case 1 in Run Code, Test case 8 in Submit Code) is bugged! I spend hours trying to cater to test case 8 but to...
C++ : Explanation: Note: This is a terrible, terrible solution. Look at the number of nested loops! Yes, it works, but loopsss! The question was not easy to understand, so the breakdown is...
C++ : Explanation: It is tempting to simply use an outer for loop (to pass candy around the prisoners), then followed by an inner while loop (to subtract prisoners after each round if...
C++ : Explanation: At first glance, this question feels like a pyramid scheme. The for loop in this case does exactly like what the question says: It first gets the number of likes...
C++ : Explanation: Using the supplied i and j in the for loop, for each i smaller or equal to j, set day = i and reverseDay = 0. Each number will need...
C++ : Explanation: This one is simply. Set the return string cancelled to “YES” as default, and number of on time student onTime to 0. For each element in vector a, if the...
C++ : Explanation: When receiving the height of the tree, the most outer if loop checks if n is equal to 0, if it is, the default height, which is 1, is returned....
C++ : Explanation: We need a string of all alphabets to determine the height of each alphabet in word for this one, and store it in variable alphabetList. In the for loop, for...
C++ : Explanation: Ok, this one had me debugging for some time due to the “Terminated due to timeout” status on Hackerrank. It was frustrating when all the smaller test cases passed but...
C++ : Explanation: First, find the max height of the hurdles in the race. Assign it to maxHeight. Then find the number of times Dan has to drink the potion by maxHeight –...