STOCK INVESTOR
CodeChefOpen on judge ↗
Steve is an investor who invests in stocks. He also knows about the future. Given the price of each stock and their returns after 2 years. Help Steve to find the best set of stocks within his budget. Print “-1” if it is not possible to buy the stocks. ### Input First line contains an integer ‘n’ denoting the number of stocks. Second line contains ‘n’ spaced integers [$P_1, P_2, P_3, …, P_n$] den
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start