โ† Traveloka questions

Distribute chocolates with minimum absolute difference sum

Filed under Traveloka

The question

Write O(1) time code to distribute c chocolates among n students such that the sum of the absolute differences of chocolates received by adjacent students is minimized, and then rearrange them to maximize the sum.

No write-up yet. Related questions below have one.

Related Traveloka questions

Collected from public candidate posts and coding forums. Updated Nov 2026.