Question: 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.

Answer: 
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.
If you call $x$ and $y$ the proportions of red and blue chameleons before breakfast, then after breakfast, those proportions are
$$\left(\frac x2,y+\frac x2\right)$$
After dinner, they become
$$\left(\frac x2+\frac{y+\frac x2}{2},\frac{y+\frac x2}{2}\right)$$
So you have to solve
$$\frac x2+\frac{y+\frac x2}{2}=x$$
which is a linear equation if you remember $x+y=1$.