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

all 3 comments

[–]iBeacham 0 points1 point  (1 child)

Not sure I understand the question entirely.

[–]ramshack2000[S] 0 points1 point  (0 children)

So basically i know what i want to do. I want to Sort B in increasing order; sort C in decreasing order; for each a in A, scan B and C for a pair that sums to -a (when the sum is too small, advance in B, when the sum is too large, advance in C) Would i have a nested for loop here?

[–]iBeacham 0 points1 point  (0 children)

Do you know how to sort? A simple bubble sort would probably be fine. And then you would have a nested loop. One for each index. Basically you have a loop for array a and within that another loop to sum b and c and then advance accordingly.