29 April 2024 Shift 1 — Smallest Number in Array

E · easyP · Verified PYQarrays

Given an array of N integers, find the smallest element. Input: First line = N. Second line = N space-separated integers.

Input
5
7 3 1 9 4
Output
1
Track minimum using a variable. Update whenever a smaller element is found. O(N) time.
← 29 April 2024 Kolkata (Q2) — Distinct Bitwise OR of Subarrays3 May 2024 Shift 1 — Sorting Algorithm (Bubble Sort) →
Report an issue with this question