In this challenge you will be given an array and must determine an array there is a special rule for all that is can be any number you choose such that your task is to select a series of given such that the sum of the absolute difference of consecutive pairs of is maximized this will be the arrays cost and will be represented by the variable below. Get a custom test developed by the hackerrank team it costs something to do this the tests that are public and available to everyone on the hackerrank site are probably searchable on google which makes it a bit too easy overall definitely in the right direction and one should always go for it without a second thought a piece of advice . In order to maximize the cost its enough to choose either 1 or bi for aiproof is left to the readersso for every index i we have two choices either 1 or bi try all possibilities overlapping subproblems are seen which can be memoized for better complexity link to my solution hackerrank
How it works:
1. Register a Free 1 month Trial Account.
2. Download as many books as you like ( Personal use )
3. No Commitment. Cancel anytime.
4. Join Over 100.000 Happy Readers.
5. That's it. What you waiting for? Sign Up and Get Your Books.