Skip to main content

Posts

Showing posts with the label codechef

Encoded String codechef January long challenge solution || Encoded String codechef January long challenge solution Editorial 2021

 Encoded String codechef January long challenge solution || Encoded String codechef January long challenge solution Editorial 2021- Problem statement- An encoder encodes the  first  16 16  lowercase English letters  using  4 4  bits each. The first bit (from the left) of the code is  0 0  if the letter lies among the first  8 8  letters, else it is  1 1 , signifying that it lies among the last  8 8  letters. The second bit of the code is  0 0  if the letter lies among the first  4 4  letters of those  8 8  letters found in the previous step, else it's  1 1 , signifying that it lies among the last  4 4  letters of those  8 8  letters. Similarly, the third and the fourth bit each  signify the half in which the letter lies . For example, the letter  j j  would be encoded as : Among  ( a , b , c , d , e , f , g , h ( a , b , c , d , e , f , g , h   | |   i , j , k , l , m , n , o , p ) i , j , k , l , m , n , o , p ) ,  j j  appears in the second half. So the first bit of its encod