Added solution for Distinct powers