5 kyu

Simple string expansion

820 of 1,980KenKamau

Description:

Consider the following expansion:

solve("3(ab)") = "ababab"     -- because "ab" repeats 3 times
solve("2(a3(b))") = "abbbabbb" -- because "a3(b)" == "abbb", which repeats twice.

Given a string, return the expansion of that string.

Input will consist of only lowercase letters and numbers (1 to 9) in valid parenthesis. There will be no letters or numbers after the last closing parenthesis.

More examples in test cases.

Good luck!

Please also try Simple time difference

Algorithms

Stats:

CreatedFeb 6, 2018
PublishedFeb 6, 2018
Warriors Trained6049
Total Skips766
Total Code Submissions9161
Total Times Completed1980
JavaScript Completions648
Python Completions820
Ruby Completions123
Haskell Completions84
C++ Completions176
Java Completions189
Clojure Completions7
Total Stars162
% of votes with a positive feedback rating95% of 390
Total "Very Satisfied" Votes356
Total "Somewhat Satisfied" Votes29
Total "Not Satisfied" Votes5
Total Rank Assessments5
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • KenKamau Avatar
  • jhoffner Avatar
  • Voile Avatar
  • rsa Avatar
  • saudiGuy Avatar
Ad