balancedBraces() function has a return type of
vector<string>, but building that vector is timing out for larger test cases. Is it okay to change the return type to
void and print the answer? This does not time out for larger tests. That would also require me to change the
You arent permitted to change the return type of the function. This is mostly because in a lot of contests and exams you dont have access to the main function . So try to work around with the function given.
One hint on how you can do is redirect your current balancedBraces() to another function which appends the new vector to another vector which is passed by reference or occurs globally and your balancedBraces() returns this vector after the operation is done.
Closing this topic as your issue is resolved by the mentor. If it is still not resolved, Kindly un-mark the accepted solution or create a new topic and post this question as a reference link in the description of the new topic.