How do you design a boolean circuit that contains at most 2 NOT gates, but may contain as many AND or OR gates that inverts three inputs? IOW: Build three inverters by using only two inverters (and an infinite amount of AND/OR).

Surprisingly, this is possible (and I even know the solution, but won't give it away just yet).

I found this puzzle again and was thinking about: How would I code a brute-force approach to this problem in Python? And to my surprise, it isn't as easy as I thought. So I'm looking for some advice from you guys

(never huts to improve ones coding skills).