Skip to content

AmmarAli12369001/MinMax_Subarray

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MinMax Subarray You are given an array of size N. The elements of the array are not necessarily distinct. Find the shortest subarray that contains at least one of the minimum and one of the maximum values.

Standard input The first line contains a single integer value N. The second line contains N integer values representing the elements of the array.

Standard output The output should contain a single integer representing the length of the wanted subarray.