## xyz

- 0of 0 votes

AnswersYou are given a string S consisting of N brackets, opening "("

- xyz in United States

and/or closing ")". The goal is to split S into two parts (left and

right), such that the number of opening brackets in the left part is

equal to the number of closing brackets in the right part.

For example, given S = "(())", the function should return 2,

because:

the first two characters of S, "((", contain two

opening brackets, and

the remaining two characters of S, "))", contain

two closing brackets.

In other example, given S = "(())))(", the function should return

4, because:

the first four characters of S, "(())", contain two

opening brackets, and

the remaining three characters of S, "))(", contain

two closing brackets.

In other example, given S = "))", the function should return 2,

because:

the first two characters of S, "))", contain zero

opening brackets, and

there are no remaining characters, so they contain

also zero closing brackets.| Report Duplicate | Flag

Arrays - 0of 0 votes

Answersgiven 2 Dimensional array

- xyz in United States

I/P -- String[][] input = { { "abc", "def", "gh" },

{ "f", "g" },

{ "qrt","xyz","pqr" } };

Program shd return a 2-D Array with

O/P -- { { "abcfqrt", "abcfxyz", "abcfpqr" ,abcgqrt and so on ..| Report Duplicate | Flag

Google SDE-2 Arrays

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

Open Chat in New Window

I was able to write this way but looks like this is not correct approach

}

- xyz March 17, 2017