Here were my test cases:-
// Provided examples {"1abc2", 1, 1, 2}, {"pqr3stu8vwx", 1, 3, 8}, {"a1b2c3d4e5f", 1, 1, 5}, {"treb7uchet", 1, 7, 7}, {"two1nine", 2, 2, 9}, {"eightwothree", 2, 8, 3}, {"abcone2threexyz", 2, 1, 3}, {"xtwone3four", 2, 2, 4}, {"4nineeightseven2", 2, 4, 2}, {"zoneight234", 2, 1, 4}, {"7pqrstsixteen", 2, 7, 6}, // Edge cases {"two1abc2three", 1, 1, 2}, {"threeightwo", 2, 3, 2}, {"oneight", 2, 1, 8},
Each test entry is a string, then either 1 or 2 depending on whether it is for part1 or part2, then the first and last numbers that should be found.
1
2
So a line like {"two1abc2three", 1, 1, 2}, should ignore the two at the start and the three at the end as they're not searched for in part 1.
{"two1abc2three", 1, 1, 2},
two
three
@Greenbank 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.
Here were my test cases:-
Each test entry is a string, then either
1
or2
depending on whether it is for part1 or part2, then the first and last numbers that should be found.So a line like
{"two1abc2three", 1, 1, 2},
should ignore thetwo
at the start and thethree
at the end as they're not searched for in part 1.