Sort by

recency

|

1456 Discussions

|

  • + 0 comments

    please tell me, why there is 5 and 4 sample input? k is the one integer parameter, so why is there 5, 4 for the k??? in the explanation it says "input is 4" so where is 5?

    all problems like that in this site, please tell me reason.

  • + 0 comments

    Python

    def hurdleRace(k, height):
        max_h = max(height)
        if max_h > k:
            return max_h - k
        else:
            return 0
    
  • + 0 comments

    This is a great problem for thinking through logic step by step. It all comes down to checking the tallest hurdle and seeing if the character can already clear it. If not, just calculate how many extra boosts are needed. Pretty straightforward but a fun way to break down constraints. It kind of reminds me of shooting range simulator, sometimes you have all the tools you need, and other times you need that extra boost to make things work smoothly. Just like how some editing software gives you everything upfront while others require add-ons to get the job done efficiently.

  • + 0 comments

    C++

    int hurdleRace(int k, vector<int> height) {
            return max(0, *max_element(height.begin(), height.end()) - k);
    }
    
  • + 0 comments

    This is a great problem for thinking through logic step by step. It all comes down to checking the tallest hurdle and seeing if the character can already clear it. If not, just calculate how many extra boosts are needed. Pretty straightforward but a fun way to break down constraints. It kind of reminds me of virtual interior decorating sometimes, you have all the tools you need to visualize a space, and other times you need that extra boost to make things work smoothly. Just like how some editing software gives you everything upfront while others require add-ons to get the job done efficiently.