Skip to main content

Practice ยท 5 of 5

Second distinct smallest (with a sentinel)

CHALLENGE
Difficulty: advanced+25 XP

Return the **second distinct smallest** value; return -1 when it does not exist (empty, one element, or all values equal). Examples: {4,1,4,2} โ†’ 2; {5,5} โ†’ -1; {-1,-1,3} โ†’ 3.

Back to lesson: Practice: Method mastery gauntlet