ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Common Board

Dynamic Programming-Google question
Posted by anish 10 Jun 2013 22:10
Given an array of integers. Find two disjoint contiguous sub-arrays such that the absolute difference between the sum of two sub-array is maximum.
* The sub-arrays should not overlap.

example- array [2, -1, -2, 1, -4, 2, 8]
answer - first (-1 -2 1 -4) Second (2 8), Maximum difference = (10-(-6)) 16.

Can you please provide recurrence relation for Dynamic Programming to solve this?It would be nice if it is accompanied with explanation.

Re: Dynamic Programming-Google question
Posted by Mahammad Valiyev 11 Jun 2013 19:36

Edited by author 12.06.2013 00:01

Edited by author 12.06.2013 00:01
Re: Dynamic Programming-Google question
Posted by Mahammad Valiyev 11 Jun 2013 20:37
But you can do it in N^4 time also by using brute force , You appear this question during interview process ?
Re: Dynamic Programming-Google question
Posted by Mahammad Valiyev 12 Jun 2013 00:01