Least number of temporary variables required to create three address code in static single assignment form for the expression $p+q*r-s/(q*r)$ I found a question.


  Least number of temporary variables required to create three address code in static single assignment form for the expression $p+q*r-s/(q*r)$


My attempt:


  $t_1 = q*r$ 
    $t_2 = s/t_1$ 
    $t_3 = p + t_1$ 
    $t_4 = t_3 - t_2$


So, I got $4$ variables but their answer is $5$. Am I missing something? Where I am being wrong?
You used the optimisation of calculating q * r only once. Maybe someone considered that "cheating" and is insisting that it must be calculated twice. I wouldn't agree with that at all, but it would explain the different answers.