We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

Perfect example of why one should not commence coding too soon. I took my dog for a nice walk while thinking about this problem. This idea came too me pretty quickly.

## Sherlock and Permutations

You are viewing a single comment's thread. Return to all comments →

It took me a while to understand the logic , but there's a catch in the problem and it's not that hard to simplify it...

fo eg: string x=11100 for the string to start from 1, just fix the position of one of the ones(1s), hence you get

now we need to find possible combinations from those 4 string digits since we have already fixed the '1' hence,

That's all, i did it in java so i used BigInteger for calc.

Perfect example of why one should not commence coding too soon. I took my dog for a nice walk while thinking about this problem. This idea came too me pretty quickly.

Below are some helpful Java methods