Consecutive subset product -


i got interview question , thinking on how solve it. lets number array ={7,6,3} , consequtive substring ares {7},{6},{3},{7,6},{6,3},{7,6,3}({7,3} not valid) check if product of 2 subsets equal).

so {6,2,3} fails {6}={2*3} can give me nudge in right direction.

if there n numbers in array. there n * (n - 1) / 2 consequtive subsets. can pre-process thess subsets' product, , insert map. enum subsets find if product have more twice in map. can solve question.


Comments

Popular posts from this blog

c# - Unity IoC Lifetime per HttpRequest for UserStore -

Change the color of an oval at click in Java AWT -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -