📚

Find Minimum

Find Minimum
쉬움 배열 +10pts

Problem

Write a function that returns the smallest number in an array.

Examples

Input: findMin([3, 1, 4, 1, 5])
Output: 1

Explanation

이 문제는 **Math.min()**과 **스프레드 연산자**를 사용하여 배열에서 최소값을 찾는 방법을 학습합니다. **Math.min() 함수** Math.min()은 전달된 인수들 중 가장 작은 값을 반환합니다: `Math.min(3, 1, 4)` → 1 **스프레드 연산자 (...)** 배열을 개별 인수로 펼쳐줍니다: `Math.min(...[3, 1, 4])`는 `Math.min(3, 1, 4)`와 같습니다. **음수 배열 처리** [-5, -1, -10]에서 -10이 가장 작습니다. Math.min은 음수도 올바르게 ...

View detailed explanation →

Key Concepts

Math.min() 함수 스프레드 연산자 최소값 알고리즘 배열 펼치기
Time: O(n) Space: O(n)
solution.js
Ctrl + Enter
Run tests to see results here.