Closing bracket index
Submissions: 1287   Accuracy:

47.46%

  Difficulty: Easy   Marks: 2

Given a string with brackets. If the start index of the open bracket is given, find the index of the closing bracket.

Examples:

Input: string = [ABC[23]][89]
          index = 0
Output: 8
The opening bracket at index 0 corresponds
to closing bracket at index 8.

Constraints:
1 <= T <= 100
1 <= N <= 104

Input:
1
[ABC[23]][89]
0

Output:
8

Explanation:
Testcase 1:
The index of closing bracket for the index of open bracket is: 8.

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Saksham Ashtputre
Author: saksham0751


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.