Sort by

recency

|

1444 Discussions

|

  • + 0 comments

    int biggestHurdle = height.Max();

    return biggestHurdle > k ? biggestHurdle - k : 0;

  • + 0 comments
    scala
        def hurdleRace(k: Int, height: Array[Int]): Int = {
      height.foldLeft(0)({case (acc, n) => max(n-k, acc)})
    }
    
  • + 0 comments

    Rust:

    (height.iter().max().unwrap() - k).max(0)
    
  • + 0 comments

    int result = Collections.max(height) - k; return result > 0 ? result : 0;

  • + 0 comments

    Solution in Java:

        int result = Collections.max(height) - k;
        return result > 0 ? result : 0;