9.1. Into reverse: An empty string is reversed by simply doing nothing. To reverse a non-empty string, remove its first character, reverse the rest, and append the removed character at the end. For example, reverse("MONTEVIDEO") can be found by using reverse("ONTEVIDEO")+"M". In the same way, reverse("ONTEVIDEO") would be equal to reverse("NTEVIDEO")+"O", and so on:
const reverse = str =>
str.length === 0 ? "" : reverse(str.slice(1)) + str[0];
9.2. Climbing steps: Suppose we want to climb a ladder with n steps. We can do this in two ways:
- Climbing one single step and then climbing an (n-1) steps ladder
- Climbing two steps at once and then climbing an (n-2) steps ladder
So, if we call ladder(n) the number of ways to climb an steps ladder...