String Transmission Discussions | Algorithms | HackerRank
  • + 0 comments

    for those who didnt unsderstood the question

    in the input we are given with length(n) and number of bits we can flip in this binary representation (k)...

    now for a particular test case we need to find the count such that after flipping the binary digit; the resultant binary digit is not periodic.

    eg first test case ...... 001 and k = 1

    now flip the 0 with 1 (flip the first digit) we get 101 ...this is aperiodic so count ++; (google definition of aperiodic string) now flip the second digit and youll get 011 ....aperiodic...count++;

    remember you can only flip the <=k digits in given binary representation

    if k == 3; you need to flip from 1 <= k <= 3......and check the aperiodics