Skip to content

maths/number_of_digits.py is naive! #2220

Closed

Description

@vasugamdha

maths/number_of_digits.py has a naive method. The suggested method has a time complexity of O(n). We can count number of digits of a number in O(1).

Activity

  1. cclauss commented on Jul 21, 2020

    @cclauss
    Member

    Can we put both algorithms into the same file and add a benchmark that proves that the theoretical performance improvement is achieved and that the proposed algorithm is noticeably faster than the current algorithm?

  2. vasugamdha commented on Jul 21, 2020

    @vasugamdha
    ContributorAuthor

    @cclauss Yes! I have proposed the algorithm that is noticeably faster as num_digits_fast() in the #2221
    Please review it. Thanks.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions