Service Lane | Hackerrank Solutions in C++
Service Lane | Hackerrank Solutions
It is an hackerrank problem you can find it by clicking here.
Below given solution is prepared by one of the coder of our.
Solution in C++
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,t;
cin>>n>>t;
int *arr;
arr = new int [n];
for(int q=0;q<n;q++)
{
cin>>arr[q];
}
for(int i=0;i<t;i++)
{
int a,b;
cin>>a>>b;
int min=INT_MAX;
for(int j=a;j<=b;j++)
{
if(arr[j]<min)
{min = arr[j];}
}
cout<<min<<endl;
}
return 0;
}

Comments
Post a Comment