(RankList for this Question)
8.4 Bob, Alice and Three Numbers
Alice has given Bob an array of distinct integers and his task is to find the number of possible triplets which add up to a given target.
First line contains the number of distinct integers and the target sum
Following line contains the n distinct integers in the array
Output the number of possible triplets
12 3 1 2 -6 5 -8 6
[-8, 2, 6], [-8, 3, 5], [-6, 1, 5] are the possible triplets which add up to the target sum which is 0.
Log In to solve the Question