Can someone please explain algorithm to solve the problem ? Pls no hints.Just plain simple algorithm!!