Some clarification about the characteristics of the input (S, L), (by trial)


  • 2
    L

    I found that the description of the problem does not give much detail about the input string and the words list. Here are a few of them that I figured out by trials. I list as follows as a supplementary information. All the examples below are the real cases from OJ.

    1). The words in the list L do NOT have to be unique.
    e.g.

    S = “lingmindraboofooowingdingbarrwingmonkeypoundcake”
    L = {"fooo","barr","wing","ding","wing"}   // expected {13}
    

    2). The words in the list might have certain parts overlapping, which makes the input a bit of tricky for certain algorithm…
    e.g.

    S = "aaaaaa";
    L = {"aaa", "aaa"}; // expected {0}
    

    3). If we consider the entire word list as a slide window, then the windows might overlap with each other in the result.
    e.g.

    S = "abaababbaba";
    L = {"ab","ba","ab","ba"};  // expected {1, 3}

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.