in reply to Re^3: Puzzle: Given an array of integers, find the best sequence of pop / shift...
in thread Puzzle: Given an array of integers, find the best sequence of pop / shift...
Hang about.....
If you are shifting and popping, aren't the indices going to change as you go?
Well, actually - only as you shift. That is, each time you shift an element off the list, the index of each remaining element is reduced by one - no?
Therfore, this whole odds/evens thing won't work at all - or have I been smoking too much happy weed? ;)
(just kidding - I never touch the stuff ;)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: Puzzle: Given an array of integers, find the best sequence of pop / shift...
by davidj (Priest) on Mar 20, 2006 at 12:36 UTC | |
by McDarren (Abbot) on Mar 20, 2006 at 12:53 UTC | |
by davidj (Priest) on Mar 20, 2006 at 14:01 UTC |
In Section
Seekers of Perl Wisdom