• + 0 comments

    Do not waste your time with that question. The question author have not thought of edge cases. Editorial and solution code are not correct.

    The question seems solvable with more exponential steps, but this makes the question much difficult.

    Example case: (Solution should be 15, but editorial code outputs 16)

    4 5
    abc
    de
    ab
    def