Log in
← All problems

Pairs with a given difference

mediumProblem solving20 XP

nums has different numbers. Return how many pairs of them differ by exactly k (k is more than 0). Use a set to make it fast.

Examples

Examples use JSON: true/false/null are True/False/None in Python.

Run examples checks the examples above. Submit also runs 3 hidden tests.