I am trying to solve one of the sample test problems in which I have to write an expression/pattern for the following language:
$\{w \in \{0, 1, 2\}^*: {\#}_{0}(w) ∗ {\#}_{1}(w) \text{ is even}\}$
I was thinking about the approach of getting all strings with even number of 0s and 1s first and then make a complement of that expression, but now I'm not so sure if my solution would also include all variations, that is:
- even number of 0s and odd number of 1s
- odd number of 0s and even number of 1s
- even number of 0s and even number of 1s
My solution: $\overline{2^{*}(002^{*}|112^{*})^{*} 012^{*}}$
Mostly I'm not so sure about points 1. and 2. and would gladly accept any help in dispelling my doubts and solving this issue.