KREDIVO Off-Campus OA (2024) | Count Pairs Whose Sum is Less Than Target
Question · Posted Jun 2026
Problem Statement Given an integer array nums and an integer target, return the number of pairs (i, j) such that: 0 <= i < j < n nums[i] + nums[j] < target Example Input nums = [-1,1,2,3,1] target = 2 Output 3 Explanation Valid pairs: (-1,1) (-1,2) (-1,1) Total = 3 Constraints 1 <= nums.length <= 50 -50 <= nums[i] <= 50 -50 <= target <= 50
The full answer & interview discussion are available to premium members.
Log in Create a free account