Code while solving some interview questions