Hopscotch: An algorithm for the numerical solution of electrochemical problems