Free written solution

Fair Candy Swap (LeetCode 888): Solution and Explanation

Alice and Bob each trade one candy box so that their totals end up equal. Find which two boxes to swap.

Read the intuition, approach, code and complexity →