Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • \$\begingroup\$ My reaction to this, as a CJam source: Wtf? explanation needed... \$\endgroup\$ Commented Oct 1, 2014 at 14:57
  • 2
    \$\begingroup\$ Nice way of getting min and max using array index instead of popping and then swapping things around \$\endgroup\$ Commented Oct 1, 2014 at 14:59
  • \$\begingroup\$ It's probably my cold speaking, but why do you sort twice? Shouldn't a sorted array stay sorted if a constant is subtracted from each element? \$\endgroup\$ Commented Oct 1, 2014 at 17:23
  • \$\begingroup\$ @IngoBürk The sorted array doesn't survive the array access, I think. Which makes sense, because the final result must not be sorted. \$\endgroup\$ Commented Oct 1, 2014 at 17:24
  • \$\begingroup\$ @MartinBüttner D'oh. Of course. We need to retain order for the result. Thanks! \$\endgroup\$ Commented Oct 1, 2014 at 17:25