spoj IITKWPCJ – Check the string Powers

you can find the problem statement here.

this is very similar to finding a common factor between two numbers but here we have to find a common factor in terms of strings and if we let ourself to find the greatest common string factor then  we can easily use the eulers gcd in terms of strings.

here’s an implementation of that idea.

https://gist.github.com/1ba3acc122c780c0d559

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s