Contest Pairing Problem
Contest Pairing Problem — ExecCode Medium DSA Practice
Solve the Contest Pairing problem on ExecCode. Free online medium DSA practice in Greedy. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Each participant has a preparation score. A pair is valid when the two scores add up to at most X, and each participant can belong to at most one pair. Return the maximum number of valid pairs. Return the maximum number of pairs. You are given: score — score limit — limit Return the maximum number of pairs. Copied from OA Lab Part 1.
Examples
Input {'score': [2, 3, 5, 6, 7], 'limit': 8}; Output 2. Input {'score': [1, 2, 3, 4, 5, 6], 'limit': 10}; Output 3. Input {'score': [1, 2, 3, 4, 5], 'limit': 5}; Output 2
Constraints
Follow the statement. Use a 64-bit integer when values can overflow.
Practice Contest Pairing free on ExecCode. Browse DSA problems, topic map, and placement guides.