Unofficial Editorials November Long Challenge (Part 1)

@taran_1407
Solution to problem PERPALIN can be simplified:

Create array[p] and a[0]=a[p-1]=‘a’
Then fill the rest of the elements with ‘b’
And finally print the array (n/p) times.

This saves some ‘increase’ hassle, probably a bit of memory too.

1 Like

Yes, if u take care of corner cases like P==2 or N == 1.

i read ur tutorial for 1st problem…didn"t budge anything :frowning:

You just have to count cities which are

For A, Either A, or ‘.’ having ‘A’ on both sides. Same for B.

Refer to my solution for details.