For a predefined number of bracket types -- you show three types -- I'd record the position of each in an array for that type and side -- so 6 arrays. Then sort the arrays, LH ascending, RH descending. Then pick through the arrays with a For loop.
On Oct 29, 3:50 am, Gourav <[email protected]> wrote: > Hi All,' > I was just making some program then i am unable to find following > Query.. > > Make a program in which Finding the position of opening and closing > brackets of { }. > Q..... { () { [ ( ) ] } { ( ) } } > Then answer should be > ___________________________________________ > Bracket { openning at 1 and closing at 14 > Bracket ( openning at 2 and closing at 3 > Bracket { openning at 4 and closing at 9 > Bracket [ openning at 5 and closing at 8 > Bracket ( openning at 6 and closing at 7 > and so on > ___________________________________________
