Confusion in question

a
aaaaaaa

how can output to this problem be 4 since set will be{1,2,3,4,5,6,7} and to pick no divisible by all nos from 1 to 9 we have to pick 3,4,5,6,7 and we have only 1 and 2 left so there are 4 ways to deal with them. thats how output is 4%mod=4??

hello @Shobhit_kumar
We will have 1,2,3,4,5,6,7 in our set
So if we take {3,4,5,6,7} then their product is 2520 which is divisible by all nos from 1 to 9
now for 1,2 we have 2 choices for both either to take them or leave them.
So 2*2=4 and thus we have 4 ways .

sir can you plz address my doubt on question square painting plz as i have asked doubt since 3 days but no one has replied there.

i cant bro , i can take/reply on those doubt that i have acknowledged.

the doubt that u r talking is taken by some other TA .

but he is not replying there

okay for this question my approach is to first find all occurrences of the pattern using KMP algo and then i have count the no. of ways of selecting from that no of ways to from no’s divisble by 2520 right?? only thing is i have to count the no. of ways effinciently right??

yeah u r on right track.

i am thinking about maintaining an array that will keep count of no of 3’s no of 2’s no of 5’s and no of 7’s that i have included so far in my answer but that would lead to MLE i guess

also in this case i have to calculate prime factorisation of every no which does not seem to effincient ?? what could i do??

dont go with pnc.
we can solve it using algorithms

sir can you plz help me with some code of this question as i am finding it difficult to come up with the soluiton of this…

check this->

steps
a) kmp to get all occurence
b) get product of all subsequence ,increment count for subsequence which gives zero remainder.
to optimise it we are using 2dp same as knapsack.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.