Hackerrank Birthday Chocolate (C++)
C++ : Explanation: This problem is about summing up a continuous m number of numbers in vector s such that they add up to d. Why a do while loop instead of a...
C++ : Explanation: This problem is about summing up a continuous m number of numbers in vector s such that they add up to d. Why a do while loop instead of a...
C++ : Explanation: This one is simple. First, set both lowest and highest score to the first element of vector scores. Next, in the for loop, check if each element is higher than...
C++ : Explanation: Ok, this one is a nice little challenge on divisors and factors. First, find the largest number in vector a and smallest number in vector b. Next, set the (temporary)...
C++ : Explanation: Make jumps (the number of max times the kangaroos can jump) an arbitrarily large number (such as 100,000 as above), then in the while loop, check if starting distance of...
C++ : Explanation: As stated in the problem, 38 is the cut off number for rounding, so we’ll go with 38 for the base number instead of having to count from 40. Modding...
C++ : Explanation: Basically doing some simple arithmetic and counting the numbers that appear in a range for 2 separate vectors. Nothing really complicated here.
C++ : Explanation: Missed this all the way till the last warmup challenge. This is simple, simply adding up all the elements of a vector in sum, then returning it. Nothing much to...
C++ : Explanation: Ok, this problem gave quite some headaches with the corner cases of 12PM and 12AM. Had to use some hackos to see the corner cases missed. But first, the general...
C++ : Explanation: There are 2 loops in this function. Basically this function is a combination of a findMax function and a countMax function. The first loop finds the max number in the...
C++ : Explanation: Using a nested for loop here, the outer loop denotes the number to skip when summing the vector, for the first loop, skip arr[0], then arr[1]… etc. The inner loops...