Question
9) Write a recursive function (static method) called parenCleaner that takes a String as a parameter, and returns a new String where all of the
9) Write a recursive function (static method) called parenCleaner that takes a String as a parameter, and returns a new String where all of the open parentheses (i.e. () have been moved to the beginning of the String and all of the closed parens (i.e. )) have been moved to the end of the String. This example question may help with this question (this is probably easier than you think). For example:
parenCleaner(x()y()z(a)) => (((xyza)))
parenCleaner(f(x,y,z)) => (fx,y,z)
parenCleaner(pumpkins) => pumpkins
public static String parenCleaner(String str) {
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started