MCPcopy Create free account
hub / github.com/HuberTRoy/leetCode / Solution

Class Solution

Array/FairCandySwap.py:71–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69"""
70
71class Solution(object):
72 def fairCandySwap(self, A, B):
73 """
74 :type A: List[int]
75 :type B: List[int]
76 :rtype: List[int]
77 """
78 x = (sum(A) - sum(B)) // 2
79 b = set(B)
80 for i in A:
81 if i - x in b:
82 return (i, i-x)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected