We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
/* * Cuddle time * Phuong Chi * Miss you */importjava.math.BigInteger;importjava.util.ArrayList;importjava.util.Collections;importjava.util.Comparator;importjava.util.HashMap;importjava.util.HashSet;importjava.util.Map;importjava.util.Scanner;importjava.util.Set;publicclassSolve_problems{staticintsolution(intn,ArrayList<Integer>arr,intentry,intexit){// Find the minimum width in the specified segmentintminWidth=Integer.MAX_VALUE;for(intj=entry;j<=exit;j++)minWidth=Math.min(minWidth,arr.get(j));returnminWidth;}publicstaticvoidmain(String[]args){Scannersc=newScanner(System.in);intn=sc.nextInt();intt=sc.nextInt();ArrayList<Integer>arr=newArrayList<>();for(inti=0;i<n;i++)arr.add(sc.nextInt());for(inti=0;i<t;i++){inta=sc.nextInt(),b=sc.nextInt();System.out.println(solution(n,arr,a,b));}sc.close();}}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Service Lane
You are viewing a single comment's thread. Return to all comments →