Selecting Stocks

Problem Overview

  • Determine the maximum profit by choosing at most one share per stock within the available savings, using predicted one-year future values.
  • Inputs: saving, currentValue[], futureValue[]; Output: an integer profit after one year.
  • Models a real-world stock investment decision under a budget with expert predictions.
  • Asked in Snowflake interviews; a common coding interview problem and interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: