HackerRank::Algorithms::Warmup::Identify Smith Numbers
We need to prime factorize the number and take the sum of digits of the factors and compare to the sum of digits of the initial number. Factorizing takes somewhat sqrt(N) time so it will fit in the time limit.
No comments:
Post a Comment