An interviewer recently asked me this question: given three boolean variables, a, b, and c, return true if at least two out of the three are true.
My solution follow
This kind of questions can be solved with a Karnaugh Map:
| C | !C
------|---|----
A B | 1 | 1
A !B | 1 | 0
!A !B | 0 | 0
!A B | 1 | 0
from which you infer that you need a group for first row and two groups for first column, obtaining the optimal solution of polygenelubricants:
(C && (A || B)) || (A && B) <---- first row
^
|
first column without third case