Problem link: www.hackerrank.com/challenges...
To solve this problem, we first need to 🔢 sort the first array in descending order and the second array in ascending order. 🔁 Then, we loop through the arrays and compare the corresponding elements. 🔄 If the sum of elements at the index where we are is less than k, we return "NO". If we reach the end of the loop, then we return "YES".
18 июн 2024