Given a string composed of parentheses characters '(' and ')' where the number of opening and closing parentheses is equal, determine the minimum number of character swaps required to make the string balanced.
A balanced parentheses string has matching opening and closing parentheses in the correct order. For example, '()' and '()()' are balanced, while '()' and '()(' are not.
Complete the function minSwaps in the editor with the following parameter(s): string s: a string of parentheses
Returns: int: the minimum number of swaps required to make a balanced parentheses string.
A string s of parentheses
The minimum number of swaps required to make the string balanced
Expert in Data Structures & Algorithms. Building tools to help developers crack FAANG interviews.
Amazon • Pending
Hackerrank • Pending
Hackerrank • Pending
Hackerrank • Pending
AMAZON ML SUMMER SCHOOL • Pending