Dsa
Hashing
Easy
Find Unique Triples
Given an array of integers, find all unique triples (a, b, c) such that a + b + c = target. Return the list of unique triples in any order. Each triple must be distinct in terms of its values.
Input format:
- The first line contains an integer n, the size of the array.
- The second line contains n integers representing the array elements.
- The third line contains the target integer.
Output format:
- Print each unique triple as a list on a new line.
Example:
Input:
6
1 2 -2 -1 0 1
0
Output:
[-1, 0, 1]
[-2, 1, 1]
[-2, 2, 0]
Key concepts
hashingarraystriples
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now