Solving Fair Candy Swap in go. Please try yourself first to solve the problem and submit your implementation to LeetCode before looking into solution.

Problem Description

If there are multiple answers, you may return any one of them. It is guaranteed an answer exists.

Example 1:

Input: A = [1,1], B = [2,2]
Output: [1,2]

Example 2:

Input: A = [1,2], B = [2,3]
Output: [1,2]

Example 3:

Input: A = [2], B = [1,3]
Output: [2,3]

Example 4:

Input: A = [1,2,5], B = [2,4]
Output: [5,4]

Note:

  • 1 <= A.length <= 10000

  • 1 <= B.length <= 10000

  • 1 <= A[i] <= 100000

  • 1 <= B[i] <= 100000

  • 1 <= A.length <= 10000

  • 1 <= B.length <= 10000

  • 1 <= A[i] <= 100000

  • 1 <= B[i] <= 100000

See the full details of the problem Fair Candy Swap at LeetCode

Originally posted at: @github.com/halfrost/LeetCode-Go