A tie takes second place
transcript
Four posts have four, nine, nine and two likes. Equal counts hold separate places. What is the count in second place?
Keep a best value and a second. The first nine becomes the best. The second nine is not above it. But it is above second place.
A count above the best pushes the best down. A count above second takes second place. A count equal to the best counts too.
The statement decides which version you solve. With ties, the answer is nine. Skipping equal values answers four.
A common bug adds a test: below the best. It works when the top count is unique. It fails the moment two posts tie.
Try seven, seven and three likes. The answer is seven. Returning three means the tie was skipped.
Real feeds rank posts by likes. Two posts often share a count. So hidden tests often include a tie.
Ask whether equal values share a place. Test two posts with the same count. Full breakdown in the lecture.