Skip to content

[FEATURE REQUEST] <title>find first previous smaller element for each element in an array using stack  #4540

@piyush-gpt

Description

@piyush-gpt

What would you like to Propose?

Given an array "input" you need to print the previous smaller element for each element in that array.
For a given element x of an array, the previous smaller element of that element is the
first smaller element to the left side of it. If no such element is present print -1.

Issue details

like there were already codes for next greater and next smaller element present in the stack folder, I felt the lack of the code for previous smaller element, so decided to work on the same.

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions