ZETA SUITE Hiring Off-Campus OA (2024) | Problem Number of Good Pairs

Question · Posted Jun 2026

Problem Statement Given an integer array nums, a pair (i, j) is called a good pair if: nums[i] == nums[j] and i < j Return the total number of good pairs. Example Input nums = [1,2,3,1,1,3] Output 4 Explanation Good pairs are: (0,3) (0,4) (3,4) (2,5) Total = 4 Constraints 1 <= nums.length <= 100 1 <= nums[i] <= 100

The full answer & interview discussion are available to premium members.

Log in Create a free account