simple algorithms preparing for interviews