Visa Inc. off campus hiring | Find the Punishment Number of an Integer | OA 2024
VISA · Question · Posted Jun 2026
Problem Statement Given a positive integer n, return the punishment number of n. The punishment number of n is defined as the sum of the squares of all integers i such that: 1 <= i <= n The decimal representation of i * i can be partitioned into contiguous substrings such that the sum of the integer values of these substrings equals i. Constraints: 1 <= n <= 1000 Example 1: Input: n = 10 Output: 182 Explanation: There are ...
The full answer & interview discussion are available to premium members.
Log in Create a free account