Loading...

The Pair Counter

A easy Python interview practice problem on DataDriven. Write and execute real python code with instant grading.

Domain
Python
Difficulty
easy
Seniority
junior, mid

Problem

A pairing service counts how many equal-value pairs can be formed from a pool of submitted items for batch matching. Write a function that takes a list of integers and returns the number of pairs of indices (i, j) where i < j and nums[i] equals nums[j].

Practice This Problem

Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.