Permuting Two Arrays

  • + 0 comments

    Python solution without implementing the sorting algorithm:

    def twoArrays(k, A, B):
        A.sort()
        B.sort(reverse=True)
        
        for i in range(len(A)):
            if A[i] + B[i] < k:
                return "NO"
                
        return "YES"