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,

- random permutations of integers
- binary comparisons
- string substitution
- convert list of numbers to a scalar

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.

Show
4 older comments

K E
on 17 May 2012

The problem is to find the number-to-string matching that results in a + b = 3, right?

Suresh Deoda
on 17 Oct 2012

Test case needs to be changed,thre can be more than 1 solution to the problem.
e.g. in question for example,[afgilstw = 74062195] is also one correct solution.

Doug Hull
on 18 Oct 2012

Suresh, Which test case? Please be more explicit. These were all taken from a list of known problems, so I need more info to understand if one is flawed.

Suresh Deoda
on 19 Oct 2012

I am saying in general there can be more than one solution e.g. the one in the question, Wait+All = GIFTS , for that[afgilstw = 74062195] is also valid solution. i.e.[ 5769 +722 = 6491]

Doug Hull
on 22 Oct 2012

Note in the instructions: "No left hand zeros"

Jean-Marie Sainthillier
on 2 Sep 2013

Difficult to solve in time.

Informaton
on 28 Aug 2017

I saw the note regarding "No left hand zeros", but did not put it together until later that it's really a hint regarding the sum; the 'G' in gifts cannot be mapped to a 0. It's clear now, but initially I thought the remark was referring to 'ALL' not having a blank character to the left (e.g. '\ ALL') that would be 0 when mapped to digits (e.g. 0677).

**Tags**

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today
4 players like this problem

4 players like this problem