FastPrepMaximum Digital Root
Problems/Maximum Digital Root

Maximum Digital Root

Visa logoVisa● EasyFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A December 10, 2025 Visa CodeSignal OA report gives the repeated digit-sum rule and the complete example with four values. It leaves out numeric limits and a function signature. Our version adds limits and the descriptive name maxDigitalRoot.

You are given an integer array values.

For each value, repeatedly replace it with the sum of its decimal digits until only one digit remains. This final digit is the value's digital root.

Return the maximum digital root among all values in the array.

Function

maxDigitalRoot(values: int[]) → int

Examples

Example 1

values = [123,456,789,101]return = 6

The repeated digit sums are 123 -> 6, 456 -> 15 -> 6, 789 -> 24 -> 6, and 101 -> 2. The maximum is 6.

Example 2

values = [999,19,0]return = 9

999 has digital root 9, 19 has digital root 1, and 0 remains 0.

Constraints

  • 1 <= values.length <= 105
  • 0 <= values[i] <= 109

More Visa Online Assessment questions

  • Count Prime Values in SubtreesOA · Seen Nov 2026
  • Lock CodeOA · Seen Nov 2026
  • Minimum-Sum Tree Fill with Unit StepsOA · Seen Nov 2026
  • Longest Non-Decreasing Substring After Pair SwapsOA · Seen Oct 2026
  • Count Attack Vectors by Divisor RangeOA · Seen Oct 2026
  • Minimum Operations to Reduce a Transaction LedgerOA · Seen Oct 2026
  • Count Valid Space-Delimited WordsOA · Seen Oct 2026
  • Earliest Common Meeting StartOA · Seen Oct 2026
  • Maximum Index-Weighted Sum with Disjoint SwapsOA · Seen Oct 2026
  • Maximum Equalized Substrings After One Adjacent SwapOA · Seen Sep 2026

Similar questions at other companies

  • Picked Player Who LostSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Total Cost Against the Lowest Earlier PricePayPal · OAPayPal interview questions
  • Count Valid Square PairsAuxoAI · OA
  • Server InvestmentRippling · OARippling interview questions
  • Basic Item DiscountsPalantir · OAPalantir interview questions
  • Next Pascal Row CoefficientIntuit · OAIntuit interview questions
  • Unique Integers That Sum to ZeroNVIDIA · OANVIDIA interview questions
  • Count Multiples of Three with Two SevensHudson River Trading · OAHudson River Trading interview questions
  • Diagonal Bounce TraversalAutodesk · OAAutodesk interview questions
  • Maximum Student-Teacher DistanceChubb · OAChubb interview questions
All Visa interview questionsSee Visa hiring insights
Saved
class Solution {
    public int maxDigitalRoot(int[] values) {
        // Write your code here.
    }

}
Checking account…