Why m I getting TLE in Power Set?

I am trying to solve this problem … but the algorithm i implement gives TLE :frowning:

This is what i tried to implement => https://www.codechef.com/viewplaintext/9848187

Please provide solution.

As you have requested only solution then here you go
for(i=0;i < n;i++){
answer= sum*power(2,n-1);

Can you please point out mistake in this algo => https://www.codechef.com/viewsolution/9860653
Seems i implemented what you said :frowning:

Please provide the code :slight_smile: @admin123

look at this same question has been asked and candidate master answered the same.