Skip to content

Check Redundant Brackets #2423

@JayGoyal96

Description

@JayGoyal96

Is your feature request related to a problem? Please describe.
For a given expression in the form of a string, find if there exist any redundant brackets or not. It is given that the expression contains only rounded brackets or parenthesis and the input expression will always be balanced.

Describe the solution you'd like
Using the concept of Stack to approach the above problem.

Sample Testcase
Expression: (a+b)+c
Since there are no needless brackets, hence, the output must be 'false'.
Expression: ((a+b))
The expression can be reduced to (a+b). Hence the expression has redundant brackets and the output will be 'true'.

Additional context
I would like to contribute in DataStructures/Stacks folder

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions