Permuting Two Arrays

  • + 0 comments

    Python solution:

    def twoArrays(k, A, B):
        # Write your code here
        for a in A:
            low = k-a
            bs = [b for b in B if b >=low]
            if bs: #if bs not empty
                B.remove(min(bs))
            else: # if bs empty
                return 'NO'
        return 'YES'