Permuting Two Arrays

  • + 0 comments

    My Python 3 solution:

    def twoArrays(k, A, B):
        A.sort()
        B.sort(reverse=True)
        if any(a + b < k for (a, b) in zip(A, B)):
            return "NO"
        return "YES"
    

    Some coders use a for loop instead of any. Is it more or less efficient to use any?