code for solutions of cs algorithmic problem