Since the number of islands is even, either the sum of areas of islands in
the even position have a greater area or the ones in the odd position have
greater area.

Eric can start from the 1st island if the sum of areas of the islands at the
odd position is greater than that of even ones.or can start from the nth
island(since n is even) if the sum of areas of the islands at the even
position is greater than that of odd ones.

Following the same approach he can get a larger area than Finn for sure.
This approach will always ensure that Eric ends up getting the larger area
but may not be the optimal solution.

Thanks,
Immanuel

On Tue, May 3, 2011 at 7:28 AM, abhishekriyer <abhishekr.iye...@gmail.com>wrote:

> Kingdom of Maplewood is a beautiful country comprising of a lot of
> small islands of different areas. All the islands are in a straight
> row. King Rosewood is getting old and has decided to divide the
> islands among his two sons - Eric and Finn. Luckily, the total number
> of islands is even. He has also decided a few rules for the division
> of islands:
>
> i) Eric and Finn will be given alternate turns to choose the islands
> ii) They can only choose one island at a time from either the
> beginning or the end of the row of islands.
> iii) Once an island is chosen by someone,it cannot be chosen by other
> person.
> Suppose you are Eric and you are given the first choice. Find out the
> maximum area you are sure you can pick.
>
>
> I dont want the solution but the logic of doing this ... I googled and
> understood its a DP problem but was unable to proceed further. Any
> help is appreciated ...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

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

Reply via email to