Price-Drop Alert Trigger

Easy ⏱ 8 min 82% acceptance ★★★★★ 4.6
Write should_alert(history, current, drop_pct) where history is the recent price list: alert (return True) when current is at least drop_pct percent below the minimum historical price — a drop below an average is noise; below the floor is signal. An empty history never alerts.

Examples

Example 1
Input
should_alert([999, 949, 989], 850, 10)
Output
True
Explanation

850 is 10.4% below the 949 floor.

Constraints

  • Compare to min(history).
  • Empty history → False.

Topics

Business Logicthresholds

Companies

FlipkartAmazonCroma Tech

Hints

Hint 1

Threshold: floor × (1 − drop_pct/100).

Hint 2

current <= threshold.

Loading the Python runtime… Run executes your code and shows printed output; Submit checks your function against this problem's examples.