Leetcode 888. Fair Candy Swap
Given two arrays of positive integers representing candy box sizes for Alice and Bob, find one pair (a from Alice, b from Bob) such that swapping them makes their total sums equal. Key insight: compute the required difference delta = (sumA - sumB)/2 and find a and b with a - b = delta (e.g., via a set lookup).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.