Showing posts with label The Hurdle Race Hacker Rank Solution in C. Show all posts
Showing posts with label The Hurdle Race Hacker Rank Solution in C. Show all posts

Wednesday, 26 August 2020

The Hurdle Race Hacker Rank Solution in C

https://www.hackerrank.com/challenges/the-hurdle-race/problem 


#include<stdio.h>

int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    int height[n],max=0;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&height[i]);
        if(max<height[i])
            max=height[i];
    }
    if(max-k > 0)
        printf("%d",max-k);
    else 
        printf("0");
}