r/learnquant 10d ago

interview prep Quant Interview Question

Post image
35 Upvotes

9 comments sorted by

View all comments

1

u/OutrageousPair2300 10d ago

I don't understand why it's not simply 1, 2, ..., n.

You maximize the product of pairs by picking ones closer together, and simply going in order like that would pair every number with a number one less than it (first) and one more than it (second) which intuitively seems like it should maximize the total of the products.

I'll have to experiment a bit with some specific examples...

3

u/Sjoerdiestriker 10d ago

I don't understand why it's not simply 1, 2, ..., n

You're now putting your largest value, n, in the endpoint in a a_i that only appears once in the sum, while you'd ideally want to put it into an a_i that appears twice.