CITADEL SECURITIES Off Campus OA 2023 | Maximum Profit with Future Stock Prices | 0/1 Knapsack

Question · Posted Jun 2026

Problem Statement You are given: present[i] → current price of the i-th stock future[i] → future selling price of the i-th stock budget → total money available for investment You may buy each stock at most once. If you buy stock i: Profit = future[i] - present[i] Your total spending cannot exceed the given budget. Find the maximum profit that can be achieved. Example 1 Input present = [5,4,6,2,3] future  = [8,5,4,3,5] budget = 10 Output 6 Explanation Stock 1: ...

The full answer & interview discussion are available to premium members.

Log in Create a free account