There is no need to sort. It can be done in O(n) with some greedy calculation. My solution is here: SleepyBrain

Read more… (21 words)

Active In

Competitive Programming

Machine Learning

Algorithms and Data Structures

ACM International Collegiate Programming Contest

Artificial Intelligence

Deep Learning

International Mathematics Olympiad

Featured Contributions

reply in this discussion

There is no need to sort. It can be done in O(n) with some greedy calculation. My solution is here: SleepyBrain

Read more… (21 words)