Sum Digits Until One
Updated
Problem statement
Given a list of strings representing numbers, repeatedly sum the digits of each number until it becomes a single-digit value. Return the mode of the resulting single-digit values.
The input is guaranteed to have a unique mode after all numbers are reduced to one digit.
For example, ["1234", "24", "33"] becomes ["10", "6", "6"], then ["1", "6", "6"], so the result is 6.
Complete sumDigitsUntilOne, which receives List<String> numbers and returns the unique modal single-digit value as an int.
Function
sumDigitsUntilOne(numbers: List<String>) → intExamples
Example 1
numbers = ["1234", "24", "33"]return = 6The process of summing the digits repeatedly until a single-digit number is obtained is as follows:
- 1234 → 1+2+3+4 = 10 → 1+0 = 1
- 24 → 2+4 = 6
- 33 → 3+3 = 6
The resulting single-digit numbers are 1, 6, and 6. The mode of these numbers is 6.
More Capital One interview questions
- Branch with the Most FilesOA · Seen Nov 2026
- Earliest Meeting Time for All EmployeesOA · Seen Nov 2026
- Earn the Most 🐝OA · Seen Nov 2026
- Digit-Coded Card ValidationONSITE INTERVIEW · Seen Nov 2026
- Rank Football TeamsOA · Seen Oct 2026
- Count Subarrays Matching a Comparison PatternOA · Seen Oct 2026
- Arithmetic Triplets After QueriesOA · Seen Oct 2026
- Count One-Swap Number PairsOA · Seen Oct 2026
- Distinct Values on Maximum-Sum FramesOA · Seen Oct 2026
- Count Records Present in A but Not BPHONE SCREEN · Seen Oct 2026
Similar questions at other companies
- Count Valid Square PairsAuxoAI · OA
- Basic Item DiscountsPalantir · OAPalantir interview questions
- Distinct Products After Removing One ElementHSBC · OAHSBC interview questions
- Find Max Sum with Same First and Last DigitMicrosoft · OAMicrosoft interview questions
- Stock PricesRubrik · OARubrik interview questions
- Get Max Discount PairsAmazon · OA
- Calculate Mean and ModeCisco · OACisco interview questions
- Happy NumberBlackRock · OABlackRock interview questions
- Find Number of Interesting PairsThe D.E. Shaw Group · OAThe D.E. Shaw Group interview questions
- Nums That Are Divisible by N 🍋Two Sigma · OATwo Sigma interview questions
Capital One interview experiences
- Capital One Coding OA Questions: 3 Experiences
- Capital One Experienced Engineer Power Day and OA: 6 Experiences
- Capital One New Grad OA Questions: 14 Experiences (Part 2 of 2)
- Capital One TDP Agentic Round (AI Coding): 7 Experiences
- Capital One SWE Power Day, Level Not Reported: 6 Experiences
- Capital One TIP Intern OA and Power Day: 13 Experiences