defmodule Solution do
@spec find_min(nums :: [integer]) :: integer
def find_min(nums) do
[head | tail] = nums
tail
|> Enum.reduce_while(
head,
fn item, acc ->
if item < acc do
{ :halt, item }
else
{ :cont, acc }
end
end)
end
end