AMD interview question

How would you build this circuit using only NAND gates

Glassdoor | Glassdoor