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.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. Prepare
  2. Algorithms
  3. Implementation
  4. The Hurdle Race
  5. Discussions

The Hurdle Race

Problem
Submissions
Leaderboard
Discussions
Editorial

Sort 1234 Discussions, By:

recency

Please Login in order to post a comment

  • ddejanoski
    2 weeks ago+ 0 comments

    C#

    public static int hurdleRace(int k, List<int> height)
        {
            return height.Any(x => x > k) 
                        ? height.Max() - k
                        : 0;
        }
    
    0|
    Permalink
  • mohsinsabir_me
    3 weeks ago+ 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|
    Permalink
  • dk1313
    3 weeks ago+ 0 comments

    python

    def hurdleRace(k, height):
        return max(max(height) - k, 0)
    
    -1|
    Permalink
  • sajidaiou314
    3 weeks ago+ 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.

    -1|
    Permalink
  • coutidarius
    3 weeks ago+ 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
    

    }

    0|
    Permalink
Load more conversations

Need Help?


View editorial
View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy