Given a string "3(ab)4(cd)" expand it into "abababcdcdcdcd"



This problem was asked in ThoughtWorks interview held in October 2018. Given a string "3(ab)4(cd)", we have to write a program to expand it into "abababcdcdcdcd".

My solution:

Kindly comment below if you have found any error or have a feedback.

References:
https://www.geeksforgeeks.org/thoughtworks-interview-experience-on-campus-2/




Comments