LeetCode 258 Add Digits

LeetCode 258 Add Digits Problem

Download Code
class Solution(object):
    def addDigits(self, num):
        """
        :type num: int
        :rtype: int
        """
        # https: // en.wikipedia.org / wiki / Digital_root
        if num < 10:
            return num
        return num - ((num - 1) / 9) * 9
Download Add Digits.py

List of all Add Digits problems

Leetcode 258 Add Digits problem solution in python3 with explanation. This is the best place to expand your knowledge and get prepared for your next interview.

Feedback is the most important part of any website.

If you have any query, suggestion or feedback, Please feel free to contact us.