e-olymp
favorite We need a little bit of your help to keep things running, click on this banner to learn more
Competitions

PP2. Week 7: April 19 - 25

Java Abstract Array Min Max

Implement abstract class Arr.

Implement class Array that extends Arr.

abstract class Arr
{
  int a[]; // array of integers
  int n; // size of array
  abstract int Min(); // Return minimum element in array
  abstract int Max(); // Return maximum element in array
}

class Array extends Arr
{
  Array (int n) // Constructor
  int Min() // Return minimum element in array
  int Max() // Return maximum element in array
}

Input

First line contains number n. Next line contains n integers in the range from 0 to 100.

Output

Print the sum of minimum and maximum element in array.

Time limit 1 second
Memory limit 128 MiB
Input example #1
5
3 6 8 2 4
Output example #1
10
Author Mykhailo Medvediev