about | help | code help+videos | done | prefs |
Write a method that returns 'str' surrounded by 'num' number of parenthesis (round brackets). For example, if 'str' is "Yoda" and 'num' is 3, you would return "(((Yoda)))". Look at the test data for more examples. As a precondition you may assume that 'num' is non-negative. There are many possible solutions to this problem. It can be done recursively, or using two loops, or even using just one loop! test2020_12_10_APP1SLHL_brackets("^", 12) → "((((((((((((^))))))))))))" test2020_12_10_APP1SLHL_brackets("*", 1) → "(*)" test2020_12_10_APP1SLHL_brackets("What should have been the LEAST popular movie in 2020?", 0) → "What should have been the LEAST popular movie in 2020?" ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 220
Copyright Nick Parlante 2017 - privacy