5 kyu

Simple string expansion

647 of 1,977KenKamau

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 Trained6041
Total Skips765
Total Code Submissions9146
Total Times Completed1977
JavaScript Completions647
Python Completions817
Ruby Completions122
Haskell Completions83
C++ Completions175
Java Completions188
Clojure Completions6
Total Stars162
% of votes with a positive feedback rating95% of 389
Total "Very Satisfied" Votes355
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