Posts

Showing posts with the label The Hurdle Race

The Hurdle Race

Image
Hacker Rank Solution The Hurdle Race Hey guys ,welcome to another blog on  hacker rank solution . this time we gonna discuss a hacker rank  algorithim  problem, which is named as  The Hurdle Race. See the example As it is very clear from the Example that ,to be able to cross all the hurdle , he should be able to jump the hurdle with the maximum height , so our first task is to find out the maximum of the array . After this, we have to find how much beverage he should drink to be able to jump the max-hurdle .this can be evaluted by subtracting the max of the array from K. Remember if K is equal or greater than max-hurdle  ,he can jump all the hurdles without drinking any beverages, so we will print zero  . Here is the code in java. import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution {     static int hurdleRace(int k, int[] height) {  ...