Ctrl K

Top-Digit Stamp

Easy
A stamp turns a positive number into a number of the same length in which every digit equals the largest digit of the original. For example, 407 becomes 777, and 1000 becomes 1111. You get an array of positive integers codes. Stamp each number and return the sum of the results.
Example 1
codes=[407, 58, 3] → 868

407 → 777, 58 → 88, 3 → 3; the total is 777 + 88 + 3 = 868.

Example 2
codes=[1000, 90] → 1210

1000 → 1111, 90 → 99; the total is 1210.

Example 3
codes=[11, 22] → 33
Constraints
  • 1 ≤ len(codes) ≤ 50
  • 1 ≤ codes[i] ≤ 10⁹
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsAdd One to a Digit Array EasyThe Lost Ticket EasyCorner Stamps on a Table EasyBest Product of Three EasyThe Biggest Triangle on the Board Easy
loading Python…
Input
codes=[407, 58, 3]
Expected
868

Run checks the first 3 tests in your browser. Submit checks all 104 tests on the server, hidden ones included.