You are reading a single comment by @Greenbank and its replies. Click here to read the full conversation.
  • 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.

    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.

About

Avatar for Greenbank @Greenbank started