"Recursive Digit Reduction to Check for Uniform Digits"
IntuitionFirst calculating the first operation and then recursively calling the same function with the string we get from the first operation. And recursively c
# Intuition
First calculating the first operation and then recursively calling the same function with the string we get from the first operation. And recursively calling the function until we get the two digits.

# Approach
The approach works by reducing the string of digits recursively. For every string:

It iterates over the string and sums adjacent digits.
After summing, it takes the modulo 10 of the result, and the new string is formed by appending these modulo values.
This process continues recursively on the new string sb formed in the current iteration.
Eventually, when the string reduces to a length of 1, the function checks whether all the digits are the same.

# Complexity
# Time complexity:


Processing Each String (Per Recursive Call):
In each recursive call, the string is processed by iterating through it and summing adjacent pairs of digits. The iteration over the string takes O(n) time.
Recursive Depth:

The recursion depth is at most n (since the string length decreases by 1 with each recursive call).
Total Time Complexity:

For each recursive call, we are doing O(n) work, and there are n recursive calls in total. Hence, the overall time complexity is O(n^2).

# Space complexity:

Recursive Call Stack:
The recursion depth is at most the length of the string n. This happens because in each step, we reduce the string by 1.
So, the recursive call stack can go as deep as n.
String Builder (sb):

In each recursive call, a new StringBuilder object is created. This object holds a string of length n-1, n-2, ..., down to 1.
The total space used by the StringBuilder across all recursive calls will sum up to O(n).

# Total Space Complexity:
Recursive call stack space: O(n)
StringBuilder space: O(n) Thus, the total space complexity is O(n).


# Code
```java []
class Solution {
    public boolean hasSameDigits(String s) {
        StringBuilder sb = new StringBuilder();
        int length = s.length();
        if (length == 1) return true;
        if(length==2 && s.charAt(0)!=s.charAt(1)) {
        return false;
        }
        for(int i=0;i<length-1;i++){
            int sum = 0;
            sum+=s.charAt(i)-'0';
            sum+=s.charAt(i+1)-'0';
            sb.append(sum%10);    
        }
        return  hasSameDigits(sb.toString());
    }
}
```
['String', 'Recursion', 'Java']