Start learning free

LESSON 162 OF 673 · LOOPS & CONDITIONALS

Hurdle Jump

Practice

Given a list of hurdle heights and a jumper's jump height, determine whether or not the hurdler can clear all the hurdles. If they can, return True; otherwise return False.

A hurdler can clear a hurdle if their jump height is greater than or equal to the hurdle height.

Examples:

Input: hurdle heights = [1, 2, 3, 4, 5], jump height = 5
Output: True

Input: hurdle heights = [5, 5, 3, 4, 5], jump height = 3
Output: False

Input: hurdle heights = [5, 4, 5, 6], jump height = 10
Output: True

Input: hurdle heights = [1, 2, 1], jump height = 1
Output: False

Note: Return True for the edge case of a list of hurdles that is empty. (Zero hurdles means that any jump height can clear them).

STEP 1 OF 3
    Ctrl + Enter to check