First solution working
Second solution