Easy Java Solution for Beginners
Upvote PleaseApproachComplexity
Time complexity:

Space complexity:
Code
# Upvote Please
![upvote.jpeg](https://assets.leetcode.com/users/images/5280e6d1-ccd5-4f40-af78-4050ea410e6a_1742535712.8630085.jpeg)
# 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
```java []
class Solution {
    public boolean hasSameDigits(String s) {
       char[] chararr=s.toCharArray();
       StringBuilder sb=new StringBuilder(s);
       while(sb.length()>2){
         sb=new StringBuilder();
        for(int i=0;i<chararr.length-1;i++){
            int digit=(Integer.parseInt(chararr[i]+"")+Integer.parseInt(chararr[i+1]+""))%10;
            sb.append(digit);

        }
        chararr=sb.toString().toCharArray();
       }

       return checksame(sb.toString());
      
    }
    public boolean checksame(String s){
        int[] hash=new int[10];
        for(char  ch:s.toCharArray()){
            hash[Integer.parseInt(ch+"")]++;
        }

        int count=0;
        for(int i=0;i<hash.length;i++){
            if(hash[i]>0)
            count++;
        }

        return count>1?false:true;
    }
}
```
['Hash Table', 'Java']