Find Minimum in Array - aloalgo

Find Minimum in Array

Very Easy

You are given a non-empty array of integers nums.

Your task is to find and return the minimum value in nums.

You may assume that:

  • The array contains at least one element.

Return the smallest element in the array.

Example 1

Input
[3, 1, 4, 1, 5, 9]
Output
1
Explanation:

The smallest value in the array is 1.

Example 2

Input
[10, 20, 30]
Output
10
Explanation:

The smallest value is 10, which is the first element.

Example 3

Input
[-5, -2, -8, -1]
Output
-8
Explanation:

The smallest value is -8.

Loading...
Input
[3, 1, 4, 1, 5, 9]
Output
1

Hello! I am your ✨ AI assistant. I can provide you hints, explanations, give feedback on your code, and more. Just ask me anything related to the problem you're working on!