r/learnquant • • 4d ago

interview prep Quant Interview Question

Post image
57 Upvotes

20 comments sorted by

View all comments

2

u/jsundqui 4d ago edited 4d ago

100 * 99 + 98 * 97 + ...

= Sum [n=1 to 50] {2n(2n-1)}

= 4 * Sum { n2 } - 2 * Sum { n }

= 4/6n(n+1)(2n+1) - n(n+1)

n=50:

= 4/6 * 50 * 51 * 101 - 50 * 51 = 169150

2

u/Competitive_Try_330 4d ago

It's 100 * 99 + 99 * 98 + 98 * 97 + 97 * 96+...

1

u/notsaneatall_ 4d ago

99 X 100+98 X 100+98 X 97+... has a higher sum. I don't think what you wrote is the highest

2

u/Competitive_Try_330 4d ago

Sorry, I made it a bit unclear. I did not try to provide an optimal solution. I just wanted to state that each number appears twice in the sum.  Have not thought about the optimal solution too much yet

1

u/Icy-Landscape-4796 4d ago

what you've written is much closer but not quite optimal.

1

u/notsaneatall_ 4d ago

I never said what I wrote was optimal, I was pretty sure it wasn't.

I suspect the optimal sequence is something like 2,4,6...100,99,97,95,93...1 or something like that

0

u/jsundqui 4d ago

I know that's what I calculated

2

u/Icy-Landscape-4796 4d ago

no? you've missed out that each number is in two products (except a1 and a100)

1

u/jsundqui 4d ago

Oh, thanks my bad.