Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Vote For New Content
The time complexity analysis seems incomplete. It only analyses the time it take...

hj3yoo

Feb 22, 2022

11

0

Comments
Miguel
Miguel 2 years ago

Highly recommend reading both approach 1 and approach 2 (in that order), as approach one explains a lot of the math involved here.

Miguel
Miguel 2 years ago

In fact, I would encourage Design Gurus to consider taking a look at the explanation there and consider revising their own explanation for the sake of clarity.

Shubham Vora
Shubham Vora2 years ago

Here's a brief explanation:

  • findSquareSum(num) Complexity: For a number num, calculating the sum of squares of its digits takes O(log N) time, where N is the number. This is because num has log10(N) digits.

  • Cycle Detection: The function eve...