There are many chameleons in the zoo. Before breakfast some of them were red and all the others were blue. After breakfast, half of the red chameleons became blue. After dinner, half of all chameleons which were blue at that time became red, bringing the total number of red chameleons to the before-breakfast level. What was the ratio of the number of red chameleons to the number of blue chameleons before breakfast?
Not sure how to approach this puzzle. Any help would be appreciated.
HINT: Say that there are $n$ chameleons, of which $r$ were red before breakfast. After breakfast there were $\frac{r}2$ red chameleons and $n-\frac{r}2$ blue chameleons. After dinner
$$\frac12\left(n-\frac{r}2\right)=\frac{n}2-\frac{r}4$$
blue chameleons turned red, bringing the total number of red chameleons to
$$\frac{r}2+\frac{n}2-\frac{r}4=r\;.$$
You can solve this for $r$ in terms of $n$, and once you’ve done that, it’s straightforward to get the original number of blue chameleons in terms of $n$ and then the original ratio of red to blue chameleons.