We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
The Hurdle Race
The Hurdle Race
+ 0 comments C#
public static int hurdleRace(int k, List<int> height) { return height.Any(x => x > k) ? height.Max() - k : 0; }
+ 0 comments Probably the easiest problem I have encountered. Javascript solution
function hurdleRace(k, height) { // Write your code here let tallestHurdle = Math.max(...height); if (tallestHurdle > k) { let dosesRequired = tallestHurdle - k; return dosesRequired } else { return 0 } }
+ 0 comments python
def hurdleRace(k, height): return max(max(height) - k, 0)
+ 0 comments Cut the cord from your wireless [service provider.] (https://www.hackerrank.com/challenges/the-hurdle-race/forum)The TextNow app gives you the same nationwide phone service starting at $0/month.
+ 0 comments My swift solution:
func hurdleRace(k: Int, height: [Int]) -> Int {
if let max = height.max() { return max - k > 0 ? max - k : 0 } return 0
}
Load more conversations
Sort 1234 Discussions, By:
Please Login in order to post a comment