http://www.codechef.com/viewsolution/5210060
I have tried so many examples seems right. Can’t figure out why i am getting a WA. Basically my approach is to have a sliding window of size 5. I just iterate through the word and check these condition:
- if current index within the sliding window:
-make ‘lucky’ starting that window and also make ‘ykcul’ in the corresponding place in string
- also track the changes count - else // non lucky region :
-see if the character at this index and (strlen - index) match
-if(no match) increase count of changes and make substitution of either char at index to (strlen - index) or vice versa depending upon which is greater
simple condition to return “unlucky” is to see if the size of the string is less than 9