We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
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
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
String Transmission
You are viewing a single comment's thread. Return to all 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