@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.
@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.
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 …
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.