Re: [algogeeks] Return index of first mismatch bracket "(" or ")"

2011-12-20 Thread Arun Vishwanathan
@shady: I guess first mismatch means the innermost open brace that doesnt have a close brace. U cannot know that the first brace does not have a closing one unless u look at the entire string. On Tue, Dec 20, 2011 at 9:23 AM, shady wrote: > ( ( ) ( ( ) ( ( ) ) ( ) for this SAMM faulty index is

Re: [algogeeks] Return index of first mismatch bracket "(" or ")"

2011-12-20 Thread atul anand
in SAMM example at the end stack has 0,3 . this means both are faulty there is no closing for both On Tue, Dec 20, 2011 at 10:53 PM, shady wrote: > ( ( ) ( ( ) ( ( ) ) ( ) for this SAMM faulty index is 0, because the > first bracket has itself found no matching > > @atul > ( ( ( () ) ) for

Re: [algogeeks] Return index of first mismatch bracket "(" or ")"

2011-12-20 Thread shady
( ( ) ( ( ) ( ( ) ) ( ) for this SAMM faulty index is 0, because the first bracket has itself found no matching @atul ( ( ( () ) ) for this first bracket is faulty as it couldn't find a closing bracket, , , you can keep a stack with map as element stack< map > map where integer is the index

Re: [algogeeks] Return index of first mismatch bracket "(" or ")"

2011-12-20 Thread atul anand
there are multiple mismatch or only one mis-match in the input string. if the given string as below :- ( ( ( () ) ) -> for this is missing match is for 1st , 2nd or 3rd bracket. what would be the answer for this. On Tue, Dec 20, 2011 at 8:10 PM, zeroByZero wrote: > In a given string arrary ar

[algogeeks] Return index of first mismatch bracket "(" or ")"

2011-12-20 Thread zeroByZero
In a given string arrary arr[] = "((()())" or any other string return index for which no match is found as for this example is index 0 and for "()()()(()" is index 6 -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send