+ 3

What is the minimum time complexity for the problem of finding Leyland numbers ?

Can you tell me what is the time complexity of my code for finding Leyland numbers ? https://code.sololearn.com/clYzkt7S2FZJ/?ref=app

31st May 2018, 10:57 AM
👑 Ak-king 👑
👑 Ak-king 👑 - avatar
1 Resposta
+ 3
Hello, looks like your code is O(n^2). Here is my version with O(log(n)*log(n)) complexity. This should be better than O(n). https://code.sololearn.com/ccAR4EcTfMvt/?ref=app Additional details here https://en.m.wikipedia.org/wiki/Leyland_number
23rd Jun 2018, 2:37 PM
Enrico Menabeni
Enrico Menabeni - avatar