Skip to content

Conversation

@tofes
Copy link

@tofes tofes commented Jun 26, 2025

More efficient solution with simpler code.

More efficient solution.
@justin-qu
Copy link
Owner

Great solution, the code is certainly much simpler. Unfortunately, O(9 * log10(B)) is not algorithmically more efficient.

The current solution is O(log10(A) + log10(B)). In the worst case, when A = B, we get O(log10(B) + log10(B)), which is equivalent to O(2 * log10(B)).

@tofes
Copy link
Author

tofes commented Jun 27, 2025

Good point on the detailed time complexity analysis, the proposed solution is slightly more indeed. However the original solution has high readability and implementation costs. The proposed solution is easier to understand and quicker to implement within a time constraint. Both solutions' time complexity are acceptable (max O(108)) which represent negligible differences. Considering the overall advantages, the proposed solution is likely to be adopted by more users, thereby enhancing the value of this repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants