• + 0 comments
    function hurdleRace(k, height) {
        
        var highest_hurdle = -Infinity
        var difference  
        
        for (var i = 0; i < height.length ;i++)
        {
            
            if (highest_hurdle < height[i]){
                
                highest_hurdle = height[i]
                
            }
        }
        difference = highest_hurdle - k
        
        console.log(`Difference : ${difference}`)
        if (difference <= 0)
            return 0
        else
            return difference
            
    }