84. Find Minimum and Maximum in an Array

You are given an array of n unsigned 8-bit integers (uint8_t). Your task is to:

  • Find the minimum and maximum values in the array
  • Print both values in a single line: first the minimum, then the maximum
     

Example-1

Input: n = 5, arr = [10 20 5 30 15]
Output: 5 30

 

Example-2

Input: n = 3, arr = [255 0 128]
Output: 0 255

 

Example-3

Input: n = 1, arr = [42]
Output: 42 42


 

Loading...

Input

5 10 20 5 30 15

Expected Output

5 30