Find first missing positive: Difference between revisions
added Arturo
(→Using filtering and sorting: fixed bug) |
Drkameleon (talk | contribs) (added Arturo) |
||
Line 292:
{3, 4, -1, 1} -> 2
{7, 8, 9, 11, 12} -> 1</pre>
=={{header|Arturo}}==
<syntaxhighlight lang="arturo">sets: @[[1 2 0] @[3 4 neg 1 1] [7 8 9 11 12]]
loop sets 's ->
print [
"Set:" s
"-> First missing positive integer:" first select.first 1..∞ 'x -> not? in? x s
]</syntaxhighlight>
{{out}}
<pre>Set: [1 2 0] -> First missing positive integer: 3
Set: [3 4 -1 1] -> First missing positive integer: 2
Set: [7 8 9 11 12] -> First missing positive integer: 1</pre>
=={{header|AutoHotkey}}==
|