@@ -60,4 +60,22 @@ public String originalDigits(String s) {
60
60
}
61
61
}
62
62
63
+ public static class Solution2 {
64
+ /**My original idea on 3/28/2021, similar to the above idea in Solution1:
65
+ *
66
+ * we can use signal characters to sort these unsorted characters out
67
+ 1. z must be mapping to zero; 0
68
+ 2. x -> six; 6
69
+ 3. w -> two; 2
70
+ 4. u -> four; 4
71
+ 5. g -> eight; 8
72
+ 6. only two digits have f: five and four, four is represented by the letter u, so the remaining f must form five; 5
73
+ 7. only two digits have v: seven and five, five is done based on rule 6, so the remaining v must form seven; 7
74
+ 8. only two digits have h: three and eight, eight is done based on rule 5, so the remaining h must form three; 3
75
+ 9. four digits could have o: zero, one, two and four, since all the latter 3 digits have been done already, so the remaining o must form one; 1
76
+ 10. all the rest of the unmapped characters must be able to form a multiple of nine; 9
77
+ 11. then all 10 digits are sorted out
78
+ */
79
+ }
80
+
63
81
}