What should the answer be if prices always decrease?

Practice this question from Best Time to Buy and Sell Stock - Greedy Pattern Practice Quiz, with options and an explanation.

Question

What should the answer be if prices always decrease?

Option A

Return the smallest loss

Option B — Correct answer

Return 0

Option C

Return the last price

Option D

Return -1

Explanation

No profitable transaction exists, so return 0.

Best Time to Buy and Sell Stock - Greedy Pattern Practice Quiz

All questions · Previous question

Open on QuizMaker