in reply to sort of misunderstanding of sort
I think values which end to be adjacent in sorted list are guaranteed to be compared, and so your technique works OK. Usual spaceship operator, as well as through-away result with map sort... or 1 for sort... will do, but are longer to type. And in fact -- don't push and then sort again, but update current minimum so far, as LanX did in his question.
|
|---|