← 返回 capitalone 的题目列表Digit Summation
类型:online_judge
capitalone
Given an array of positive integers, split each number into its individual digits, sum them until it becomes a single digit, and return the most frequent single-digit in the final array.
Input:
An array arr of positive integers
Output:
A single integer representing the most frequent single digit in the array
Example:
Input: [38, 123, 5]
Output: 3
Notes:
Each number in the array will be split into digits and summed until it becomes a single digit
Example
Input
[38, 123, 5]