Triplet with given sum

Revision en1, by HighHopes, 2019-10-25 20:59:44

Given an array and a value Sum, we need to print any three indices i, j, k such that i != j and j != k and arr[i] + arr[j] + arr[k] = Sum. Can we do it in better than N^2, something like NlogN?

Tags #binary search, #sorting

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English HighHopes 2019-10-25 20:59:44 222 Initial revision (published)