Scala solution with implicit, recursion and pattern matching
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```scala []
object Solution {
    def hasSameDigits(s: String): Boolean = {
        val array = s.toCharArray
        array match {
            case Array(v1, v2) =>
                v1 == v2
            case array: Array[Char] =>
                hasSameDigits(sumDigits(array, Array[Char]()).mkString(""))
        }
    }

    def sumDigits(array: Array[Char], result: Array[Char]): Array[Char] = {
        array match {
            case Array(_) =>
                result
            case Array(v1, v2, tail @ _*) =>
                val value = ((v1.asNum + v2.asNum) % 10).asChar
                sumDigits((v2 +: tail).toArray, result :+ value)
        }
    }

    implicit class ConvertToNum(c: Char) {
        def asNum: Int = c - '0'
    }

    implicit class ConvertToChar(i: Int) {
        def asChar: Char = (i + '0').toChar
    }
}
```
['Scala']