Back to course home
0% completed
Vote For New Content
Time Complexity Struggle
maagjoel1
Aug 31, 2023
I am struggling to understand the time complexity of this solution. Specifically with why M = log(N +1). Where does this come from?
0
0
Comments
Comments
Z
zafeiropoulou.dimitra@gmail.com 2 years ago
plus one
Shubham Voraa year ago
Here's a brief explanation:
-
findSquareSum(num)Complexity: For a numbernum, calculating the sum of squares of its digits takesO(log N)time, whereNis the number. This is becausenumhaslog10(N)digits. -
Cycle Detection: The function eve...
On this page