Previously this code was applying the required operations to every second digit starting from the LEFT. The correct solution applies the required operations to every second digit starting from the RIGHT. The fact that this was not caught by the tests is a problem! The canonical tests have been updated since this exercise was last overhauled, so next steps should be to update to match the expanded canonical test suite, then test against a broken implementation to see if it is now caught. Even if it is, it may be worth including an explicit left vs right test in the canonical suite if one does not already exist.
|
|
||
| 9 |
|
9 |
|
| 10 |
|
10 |
|
| 11 |
|
11 |
|
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
| 12 |
|
15 |
|
| 13 |
|
16 |
|
| 14 |
|
|
|
|
17 |
|
|
| 15 |
|
18 |
|
| 16 |
|
19 |
|
| 17 |
|
20 |
|
|
|
||
| 40 |
|
43 |
|
| 41 |
|
44 |
|
| 42 |
|
45 |
|
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
|
49 |
|
|
| 43 |
|
50 |
|