Hackerrank Repeated String (Javascript)
Javascript : Explanation: At first glance, this seems like a very simple problem. Simply repeat string s for n times, then use substring to find the number of ‘a’ that appears. This works...
Javascript : Explanation: At first glance, this seems like a very simple problem. Simply repeat string s for n times, then use substring to find the number of ‘a’ that appears. This works...
Javascript : Explanation: The first if statement takes care of the corner case of 2 elements in c, such that it will always at least have 1 jump (actually, a do while loop...
Javascript : Explanation: For the first step of Gary’s hike, check if it is above or below sea level, if it < 0, add 1 to noOfValleys (Entering a valley in his 1st...