Skip to content

Bug Report for online-stock-span #6130

Description

@ishivanshh

Bug Report for https://neetcode.io/problems/online-stock-span

Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.

span is 3 not 4.

For example, if the prices of the stock in the last four days is [7,2,1,2] and the price of the stock today is 2, then the span of today is 4 because starting from today, the price of the stock was less than or equal 2 for 4 consecutive days.

  • For today's 2, we don't look for all previous days whose price is ≤ 2. We start from today and move backward continuously until we encounter a price greater than 2. so here the span is 3 not 4.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions