def twoArrays(k, A, B): count = 0 A.sort() B.sort(reverse=True) for i in range(0, len(A)): if A[i] + B[i] >= k: count += 1 if count == len(A): return "YES" return "NO"
리스트 요소 정렬 오름차순 : A.sort() 내림차순 : B.sort(reverse=True)
https://www.hackerrank.com/challenges/one-month-preparation-kit-two-arrays/problem?h_l=interview&isFullScreen=false&playlist_slugs%5B%5D=preparation-kits&playlist_slugs%5B%5D=one-month-preparation-kit&playlist_slugs%5B%5D=one-month-week-one