Question
Imagine you have S amounts of savings in integers. You are thinking of buying stocks. Someone has provided you with 2 N-sized arrays of stock
Imagine you have S amounts of savings in integers. You are thinking of buying stocks. Someone has provided you with 2 N-sized arrays of stock purchase prices, and their sell prices the following day. Write an algorithm that is able to take in S and the 2 arrays, and return the maximum profits that you are able to achieve the following day. Note that the lengths of the 2 arrays are equal. The number at index i in the first array shows the purchase price of the ith stock and the number at index i in the second array shows the sell price of the ith stock.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started