Open hobovsky opened 1 year ago
Another idea: remove the kata, replace it with a new one, with additional requirement of handling all occurrences of digit string except the final one (i.e. for input "1ab23cd04e-56gh99"
would be "2ab24cd05e-57gh100"
.
The kata String incrementer could use some improvements:
"a1bc2"
are missing.I could fix the kata, (and use this opportunity to collect some samples for my library of snippets ;) ) but first it would have to be decided:
"ab-123"
, because it would be parsed as a negative number and produce"ab-122"
. Similar issue can be caused by a character used as a decimal point. Question: is a hyphen, a dot, or any characters other than[a-zA-Z0-9]
, a valid input?abc + "123" * 100
?I would say yes, inputs should contain potentially large numbers. The argument that some languages have bigint and this would make solutions inconsistent between languages does not buy me, because I would just blame it on qualities of languages, and not on the problem itself. Python users are just lucky guys.
It would be also nice to figure out what are potentially interesting inputs. For now, I got:
"abc12"
"abc"
"ab99"
"abc0042"
, and leading zeros overwritten by a carry:"ab099"
, "abc0099"`"123"
,"99"
,"099"
"abc" + "123".repeat(100)
"abc-123"
, "abc12.3"`, if agreed to be included."ab123c456"
Something else I am missing?