Help with Problem Physics Class. LTIME17

I am unable to find the error in my

[1]. Please help. It gives AC for most of the tasks except one. 

Thank you. 


fails for the case


4 2

1 2 4 8

ans should be 6 -> (1,2) , (2,4) , (4,8) , (2,8) , (1,4) , (1,8)

1 Like

can anybody help me my answer is correct in most of the cases but anywhere it is falling behind …;(
please help
my solution link is

Thank you. cant believe made that mistake!

i dont know much python … But why are you just checking till f**10 , it can be upto 32.
Second: Your nsquare algorithm wont work for all tasks.

Can somebody help me in finding why am I getting TLE in this submission?