algorithm for interview