Is it possible to design $\text{DFA}\{x,y\}$ that has at least $2$ $x$'s and at most $2$ $y$'s?

96 Views Asked by At

$L = \{w|$, $w$ has at least $2 x$'s and at most $2 y$'s}

I tried making one but it does not accept aab nor aabb.

If it's possible to draw one, how do you do it? plus is it possible to draw NFA?

enter image description here

1

There are 1 best solutions below

2
On

enter image description here

Here each time a $y$ is received, we move down 1 row until we reach $q_9$ (the trash).

Each time an $x$ is received, we move across 1 column until the accepting states.

(Plus it is always possible to draw an NFA first, then convert to DFA.)