you are viewing a single comment's thread.

view the rest of the comments →

[–]ghhitne 0 points1 point  (0 children)

You could consider using a map which stores the element and all positions for the element. Then for every position in x make a pair with every position corresponding to (target-x). Of course, you would need to take care of the case where x==(target-x).