Given an array of numbers, find out if 3 of them add up to 0

0

time complexity O(n^2)

[gist https://gist.github.com/vishnujayvel/5944352]

Basically using a sorted array, for each number (target) in an array, you use two pointers, one starting from the front and one starting from the back of the array, check if the sum of the elements pointed to by the pointers is >, < or == to the target, and advance the pointers accordingly or return true if the target is found.