We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Stock Maximize
- Discussions
Stock Maximize
Stock Maximize
Sort by
recency
|
29 Discussions
|
Please Login in order to post a comment
Here is a hint on how to make this much easier and optimize the runtime: Go through the prices array backwards.
Second hint: track the maximum price and the current price. Use that to find your profits.
Java O(n)
Java 8 solution using Recurssive method calls: