please accept my solution

I have submitted simple and difficult both version