Get best answers to any doubt/query/question related to programming , jobs, gate, internships and tech-companies. Feel free to ask a question and you will receive the best advice/suggestion related to anything you ask about software-engineering , development and programming problems .

0 like 0 dislike
1,751 views

in Online Assessments by Expert (144,420 points)

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 (144,420 points)
...