BackmediumArrays Uber Razorpay

Detecting Price Floor in Fluctuating Market Solution

Problem Statement

Given a list of stock prices that were initially sorted in ascending order but then fluctuated due to market changes at an unknown point, find the lowest stock price using an efficient algorithm.

Example 1
Input
[1, 2, 3, 4, 5, 0, 6, 7, 8, 9]
Output
0

Explanation: Step-by-step: The fluctuation point is at index 5, which is after the minimum price. We return the minimum price, which is 0.

Example 2
Input
[10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
Output
10

Explanation: Step-by-step: The fluctuation point is at index 5, which is after the minimum price. We return the minimum price, which is 10.

Constraints

  • 1 <= array length <= 1000
  • All elements are distinct positive integers.
Live Compiler
Loading...
Test Cases & Output
🔒 Sign up to run your code

🚀 Practice this problem

Run code, get AI hints & track streak

Sign Up Free