bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths
EasyMath & GeometryLC 258

Add Digits

Given an integer num, repeatedly add all its digits until the result has only one digit, and return it.

Asked at 4 companies
AdobeAppleBloomberg
Hints
  • 1.Think about which data structure fits best
  • 2.Consider the time complexity of your approach
  • 3.Look for patterns in the constraints
LeetCode