Citadel OA | Profit Targets | Citadel Online Assessment Question
- There are 4 pairs of stock that have the sum of their profits equals to the target 12. Note that because there are two instances of 3 in the
stock_profit
where are two matching (9, 3):stock_profits
indices 2 and 7 and indices 2 and 8, but only one can be included. - There are 3 distinct pairs of stocks: (5, 7), (3, 9), and (6, 6) and the return value is 3.
Constraints
1<=n<=5*10^5
1<=stock_profit[i]<=10^9
0<=target<=5*10^9
Try it yourself
Solution
This is a companion discussion topic for the original entry at https://algo.monster/problems/citadel-oa-profit-targets/