Design a Mealy type state machine with input X and output Y. Y should be 1 whenever the sequence 110 or 101 has been detected on X on the last 3 consecutive rising clock edges (or ticks).
Otherwise, Y=0. Use at most two D flip-flops. An example input-output combination is given below:
X 0 0 1 1 0 0 1 0 1 0 0 1 1 1 0 1 0 0 1 0 1 1 0 0 1 1 0 0 1 1
Y 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 1 0 1 0 0 0 1 0 0 0