Back to the 2025 paper

Module 2: Context-Free Languages (CFL) and PDA

20257m

Design a context-free grammar (CFG) that generates all palindromes over the alphabet {0, 1}. The grammar should generate both even-length palindromes (e.g., 0110) and odd-length palindromes (e.g., 010).

Similar questions