

























这是一个创建于 772 天前的主题,其中的信息可能已经有所发展或是发生改变。
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
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。