Google | Phone Screen | Binary Sequence
Anonymous User
1167

Given start, end binary sequence and safe states. Check whether it is possible to reach end sequence from start sequence. You can change only one bit at a time, the new sequence after changing one bit should be in safe states.

Ex:

  1. start - 1101
    end - 1010
    safe states - [1111, 1100, 1110, 1010]

    1101 -> 1111 -> 1110 -> 1010
    Answer - True

  2. start - 1111
    end - 0000
    safe states - [0001, 0011]

    Answer - False

What are the mimimun number of safe states required for the sequence of size n, to be always able to reach from start to end.

Comments (5)