NeetCode #916LC-2698MediumMath & Geometry
← Back to All Problems#916 · #2698 · Find the Punishment Number of an Integer(求一个整数的惩罚数)
📌 Problem Statement & Constraints
An integer
i is called punishable if the decimal representation of i^2 can be partitioned into contiguous substrings whose integer values sum to exactly i. Given n, return the sum of i^2 over all punishable i in [1, n]. Constraints: 1 <= n <= 1000.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!