Duh,
my bad. My solution failed on [ 9, 9, 7, 6, 5 ] from comment assertion. I patch the code and tada.. it works :) and I see the nature of the solution of this problem.
interesting!