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
(1) (1100)
now we need to find possible combinations from those 4 string digits since we have already fixed the '1' hence,
(4)c(noOfZeroes)= 4!/2!(4-2)!=6(ans)
That's all, i did it in java so i used BigInteger for calc.
Seems like cookies are disabled on this browser, please enable them to open this website
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.