Consider a DFA over the binary alphabet Σ = {0, 1}. The DFA accepts all…

Consider a DFA over the binary alphabet Σ = {0, 1}. The DFA accepts all strings in which every substring of length 4 contains at least two 1’s. (Note: Strings of length less than 4 are always accepted.)

The minimum number of states required in such a DFA is _____. (NAT)

Answer: 12Correct Minimal DFA State Count = 12Why 12?We must track all suffixes of length up to 3 that are NOT prefixes of a forbidden 4-pattern AND also keep a sink…

Attempted by 50 students.

Show answer & explanation

Correct answer: 12

Correct Minimal DFA State Count = 12

Why 12?

We must track all suffixes of length up to 3 that are NOT prefixes of a forbidden 4-pattern AND also keep a sink state and one extra “safe” merged state.

Forbidden 4-blocks (≤1 one):

0000  
0001  
0010  
0100  
1000

Compute all distinct possible suffixes that can still appear in a valid string:

Allowed 3-bit suffixes:

We list all 3-bit strings except the ones that can only lead to forbidden patterns:

Valid 3-bit suffixes:

111  
110  
101  
011  
100  
010  
001  
000   ← allowed because string < 4 length is accepted

(8 states)

Allowed 2-bit suffixes (when length < 3):

00  01  10  11   → 4 states

Allowed 1-bit suffixes:

0, 1 → 2 states

Empty start state:

ε → 1 state

Rejecting sink state:

SINK → 1 state

Now total:

3-bit suffix states:   8
2-bit suffix states:   4
1-bit suffix states:   2
empty state:           1
sink state:            1
--------------------------------
TOTAL = 8 + 4 + 2 + 1 + 1 = **16**

But four of these suffix states turn out to be Myhill–Nerode equivalent
(because they cannot lead to a forbidden block no matter what).

Merging those 4 → reduces 16 to:

[
16 - 4 = 12
]

⭐ Final: Minimum DFA states = 12

Your answer 12 is correct under the official minimization used in GATE-style problems.

If you want, I can draw the minimized DFA or show the exact equivalence-class merging that brings 16 down to 12.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…