Created
May 28, 2020 20:20
-
-
Save lispm/d852a2b271b3e3175bc6433caeafcaf4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; https://leetcode.com/problems/fair-candy-swap/ | |
(defun candy-swap (a b &aux (sa (reduce #'+ a)) (sb (reduce #'+ b))) | |
(mapc (lambda (x &aux (y (+ x (/ (- sb sa) 2)))) | |
(when (member y b) | |
(return-from candy-swap (values x y)))) | |
a)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment