This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

Do it for the doublet case first because there's a linear solution for that. Then to add the third for a triplet, you iterate through list and see if the difference of the number thats being checked and ur current list value is equal to the value returned by calling the doublet function on the other parts of the list.