Count Pairs Whose Sum is Less than Target Problem

Count Pairs Whose Sum is Less than Target Problem — ExecCode Easy DSA Practice

Solve the Count Pairs Whose Sum is Less than Target problem on ExecCode. Free online easy DSA practice in Two Pointers. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given a 0-indexed integer array nums of length n and an integer target, return the number of pairs (i, j) where 0 <= i < j < n and nums[i] + nums[j] < target.

Examples

Input {"nums": [7, 3, 5], "target": 10}; Output 1

Constraints

1 <= nums.length == n <= 50 -50 <= nums[i], target <= 50

Practice Count Pairs Whose Sum is Less than Target free on ExecCode. Browse DSA problems, topic map, and placement guides.