Cody

# Problem 621. Cryptomath: Addition

```    W A I T
+   A L L
---------
G I F T S```

equals:

```    9 6 0 8
+   6 7 7
---------
1 0 2 8 5```

Given strings a,b,c find where a + b = c; No left hand zeros. All solutions are believed to be unique.

Beware, the test machine might time out your entry!

If you want some easier problems that build up to this one,

Why are the above building blocks to solving this problem? Well, let's think about the simplest thing that could possibly work.

If we

• Made random mapping of the ten or less characters to the ten digits
• Converted the characters to a vector of numbers
• Converted the vector of numbers to a scalar
• Checked the scalars in the summation
• Tried again if it did not work

Eventually, we would find the correct answer. Worst case scenario, we have a one in 10! (1/3,600,000) chance of stumbling upon the answer. For the eight character case, it is 8! (1/40,320). I like those odds enough that it is worth trying.

A supplemental problem finds out which technique, methodical or random is better.

### Solution Stats

44.62% Correct | 55.38% Incorrect
Last solution submitted on Nov 07, 2018