Loading...

The Triplet Hunt

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

Domain
Python
Difficulty
medium
Seniority
senior

Problem

Our constraint solver needs to find all unique triplets in a dataset that sum to a target value. Write a function called three_sum that takes a list of integers and a target k, returning all unique sorted triplets that sum to k. No duplicate triplets in the output.

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.