Opening the reading…
Opening the reading…
DSA FUNDAMENTALS › ARRAY BASICS
This is a scratch drill — your code runs, nothing is graded or recorded. No test cases, no expected output, no verdict.
TASK
Implement the one-pass candidate scan for the array [4, 1, 1, 3, 2]. A value may replace second only when it is strictly greater than min and smaller than the current second, or when no second candidate exists. Print 2, while retaining the hasSecond branch that prints -1 when no distinct second minimum exists.
OUTPUT
Sample2
What a finished answer prints, from the lesson. Nothing has run yet — press Run and this is replaced by your program’s own output.