Skip to content

[ENHANCEMENT] Replacing Parenthesis Algorithm #674

@11-aryan

Description

@11-aryan

What would you like to share?

In #492, the algorithm for checking parenthesis seems to be redundant, as it merely checks if all the opened parenthesis are closed or not. Instead, a better algorithm would be to check if the parenthesis is valid or balanced, which is a very standard algorithm.

Extra issue details

For example, in the parenthesis sequence )))(((, the current algorithm would return true as initially, the parcounter is decremented due to ) and then later incremented, eventually becoming 0, but this is invalid as the ) has started before (.

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