my solution for codechef's practice problems