Skip to main content

Practice · 5 of 5

Min positive with absence

CHALLENGE
Difficulty: intermediate+25 XP

Implement int minPositive(int[] arr): the smallest value strictly greater than 0, or -1 when no positive value exists (empty arrays included). Two machines cooperate here: a sentinel for "found yet?" and an accumulator for the minimum.

Back to lesson: Practice: Flow lab