Arrays

int[] arrays: creation, reading, traversal and finding the maximum.

An array stores many values of one type. In Java an array is created with the new operator and a size, and its length is stored in the length field. Indices run from 0 to length - 1. Going out of bounds throws an ArrayIndexOutOfBoundsException — and earns a Runtime Error verdict from the judge.
Java

Enter: 5, then 1 3 5 2 4

The program prints the array in reverse order — the loop runs from the end. The second basic technique is finding the maximum: take the first element as the current maximum and update it in a loop.
Java

Finding the maximum. Enter: 5, then 1 3 5 2 4

Task: find the minimum of the same array and print the minimum and maximum separated by a space. Then solve the attached problem "Maximum in an Array" and mark the lesson as completed.

Practice problems

Доска