Back to problems

Scale Digit-Square Convergence Requests

System Design · Apple · Medium

Design a service that answers one type of query. Each query supplies a positive integer n. Starting from n, repeatedly replace the current value by the number obtained by squaring each decimal digit and adding the results. The service must return true if this process eventually reaches 1, and false otherwise. The service must meet the following requirements: It must support billions of queries over its lifetime. Individual query latency must remain low. Repeated work for…

Checking your access…