Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
0 like 0 dislike
1,040 views

in Online Assessments by Expert (108,190 points) | 1,040 views

1 Answer

0 like 0 dislike
you are given N pairs. You are also given two integers k1 and k2.
for 0 < i < n and 0 < j < n, a pair of indices i and j is fancy if:

1. i < j
2. pairs[i][0] + pairs[j][0] <= k1
3. pairs[i][1] + pairs[j][1] <= k2,
return the count of fancy pairs

 

pairs = [[1,2],[2,3],[3,4],[4,5]], K1 = 6 and k2 = 7, Then answer should be 4, taking index (0, 1) (0, 2) (0, 3) (1, 2)
by Expert (108,190 points)