I think your problem is here:
Object.keys(strNumMap).reduce((res, key) => { const index = str.indexOf(key); if (index > -1) { res[key] = index; } return res; }
It's not handling strings with multiple of the same number correctly. E.g. 121 is getting mapped to 12 instead of 11.
121
12
11
Nice one, that's definitely it.
@zooeyzooey started
London Fixed Gear and Single-Speed is a community of predominantly fixed gear and single-speed cyclists in and around London, UK.
This site is supported almost exclusively by donations. Please consider donating a small amount regularly.
I think your problem is here:
It's not handling strings with multiple of the same number correctly. E.g.
121
is getting mapped to12
instead of11
.