My issue
My code
#include <stdio.h>
int main() {
int N;
int K;
printf("Enter the number of players: ");
scanf("%d", &N);
printf("Enter the height of Gi-Hun and Ali: ");
scanf("%d", &K);
int tallest = 0;
int count = 0;
for (int i = 0; i < N; i++) {
int height;
printf("Enter the height of player %d: ", i + 1);
scanf("%d", &height);
if (height > tallest) {
tallest = height;
}
if (height == K) {
count = 0;
} else if (height < tallest) {
count++;
}
}
printf("Minimum number of players to be removed: %d\n", count);
return 0;
}
Learning course: Solve Programming problems using C
Problem Link: CodeChef: Practical coding for everyone