✏️ 4.1.1.3 Whiteboard Practice: Recursion
You will get a chance to practice whiteboarding a lot during this course section. Time will be set aside during most class sessions at the discretion of your teacher. Use this time wisely to improve both your whiteboarding and functional programming skills!
Practice with Recursion
Alternate problem #1 and #2 with your pair.
Problem #1
Write a recursive function that reverses the order of words in a sentence. For instance, "I am a cat" should become "cat a am I".
Problem #2
Write a recursive function that concatenates "red green refactor" to a string X number of times, where X is the argument passed into the function. rgr(3)
should return the following:
"red green refactor red green refactor red green refactor"