Charging chaos

Solved in linear time by limiting the search space