Page 1 of 1

DCP-381: MULTIPLICATION

PostPosted: Thu Nov 30, 2017 6:25 pm
by Reayz
How to solve this problem? Any hints or algorithm...

Re: DCP-381: MULTIPLICATION

PostPosted: Sat Dec 02, 2017 1:59 pm
by BishalG
You may think about dynamic programming.
There will be two transitions:
1.) take and multiply the value at index p.
2.) do not take value at index p.

Re: DCP-381: MULTIPLICATION

PostPosted: Sun Dec 03, 2017 10:55 pm
by Reayz
But value can be very large, how to use this value as a state of DP?

Re: DCP-381: MULTIPLICATION

PostPosted: Tue Dec 05, 2017 2:02 am
by HarryVolde
You have to find a formula.
Find a formula for fewer elements sets.You can use the formula larger elements sets :D

Re: DCP-381: MULTIPLICATION

PostPosted: Tue Dec 05, 2017 9:33 am
by BishalG
You just need to memorize "position" state to determine whether to take value at that position or not.
As the length of array is 1000. You can easily manage that in dp.

Re: DCP-381: MULTIPLICATION

PostPosted: Wed Dec 06, 2017 1:55 am
by Reayz
Thanks everyone, including Rajib vai for helping me in this problem. AC...:)