I have solved it but i want a good solution for his can you please provide

MY SOLUTION->

I have also solve this question by this method. I will tell if i can get a better solution.