Update Digits.java

Updated how the comparison works. HashMap should be more efficient