write a Python program to split it into groups of perfectly matched parentheses without any whitespace | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

write a Python program to split it into groups of perfectly matched parentheses without any whitespace

(---Without using function----) Input:  ( ()) ((()()())) (()) () Output: ['(())', '((()()()))', '(())', '()'] Input:  () (( ( )() ( )) ) ( ()) Output: ['()', '((()()()))', '(())']

5th Aug 2022, 7:40 AM
Jeel Bhalodiya
Jeel Bhalodiya - avatar
2 Réponses
+ 1
Hint: stacks sre usually good for this. You could also use a left counter and a right counter
5th Aug 2022, 7:46 AM
John Doe
0
Please link your attempt
5th Aug 2022, 7:41 AM
John Doe