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");
}

No comments:

Post a Comment