Search
⌘K

Leetcode 2698. Find the Punishment Number of an Integer

Sum the squares i^2 for all i in [1..n] such that the decimal digits of i^2 can be partitioned into contiguous substrings whose integer values add up to i. This is solved by testing each i with a DFS/backtracking over digit partitions (n ≤ 1000, i^2 has at most a few digits so pruning suffices).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.