Answer the question
In order to leave comments, you need to log in
How to rewrite code (C) to make it run faster?
#include <stdio.h>
#include <math.h>
int main(){
int i,j,min,n;
int size = 0;
scanf("%i", &size);
scanf("%i", &n);
int N[size];
for (i = 0; i <=(size-1); i++){
scanf("%i", &N[i]);
}
for (i = 0; i <=(size-n); i++){
min=N[i];
for (j = 0; j <=(n-1); j++){
if(N[i+j]<min){min=N[i+j];}
}
printf("%d\n",min);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question