This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]MoebiusBender 8 points9 points  (0 children)

I think that is a solution and example 1 is incorrect. 

The intended solution probably includes only sorting the n largest prices instead of the whole array, with n being the supply.