Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.

Recursion Graph below tells us that first we will fill all left brackets and while filling right brackets , we will check whether the count of left bracket is greater so that we can add right bracket in the tree.

Hope it will help someone to understand better how can we make problem simple by taking it as a tree.

--

--

--

Principal Software Engineer , Mobile Engineering

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to set-up WSO2 Identity Server User Portal in an development environment

HTB Business CTF 2021: [Forensic] Compromised

Your first automated workflow with ArcPy (part 1)

How to update Flutter 2.0

How to update Flutter 2.0

Breakthroughs in EDA, Women’s History Month, and the Case for Cloud Computing: The Synopsys March…

How to solve the 3 biggest Oracle Cloud testing challenges with “Risk-based” Continuous Testing?

Decode Base64 String to File in Java

VPC with a single Public Subnet

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Amit Gupta

Amit Gupta

Principal Software Engineer , Mobile Engineering

More from Medium

Let anxiety be your guide: how to know when to keep going during a sabbatical

Is Africa Appreciating or Devaluating her Uniqueness?

4 Ways Living With Art Can Change Your Life

Favors Love Rants: Can Two Walk Together Unless They Agree?