Ya as minotauraus said it can be approached like a max_subarray problem
but a minor modification
a[i][j] is a SET....
define  a[i][j] as the possible product ending at i... j is used to indicate
if it was extended from previous window r starting at i...0- for ext  1-for
new start
for every i calculate ,

a[i][0]= a[i-1][0](every el in the set) *a[i] , a[i-1][1] * a[i]

a[i][1]=a[i]

check if a[i][0] or a[i][1] is equal to k and print accordingly

Here set is used becuase the windows that can be extended at i always
increases by 1....so its better to use a set



S.Nishaanth,
Computer Science and engineering,
IIT Madras.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to