MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / main

Function main

Hackerrank_problems/Service Lane/solution.c:5–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3#include<stdio.h>
4
5int main(){
6
7 int n,t,width[100000],i,j,k,m,p;
8 scanf("%d %d",&n,&t); //read the n and t
9
10 for(p=0;p<n;p++){
11
12 scanf("%d",&width[p]); //read the widths of the lane
13
14 }
15
16 for(k=0;k<t;k++){ //for each test cases
17
18 int min=3;
19 scanf("%d %d",&i,&j); //reading the query
20
21 for(m=i;m<=j;m++){
22
23 if(width[m]<min)
24 min=width[m]; //check for the minimum width for the query
25
26 }
27
28 printf("%d\n",min); //print the desired output
29
30 }
31
32 return(0);
33
34}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected