Expressive Words


  • 0

    Click here to see the full article post


  • 0
    P

    That's a great solution! Is itertools.groupby(S) a function you think is worth knowing about? How else could I do it? Thanks @awice!


  • 0
    S

    java version , line 13, should it be "break" instead of "continue"?


  • 0
    F

    @slipperass I think line 6 should be search: for (String word: words) .


  • 0
    S

    @awice The solution code gives a compile error : " not a loop label: search "


  • 0

    @sschangi @fk2469 @slipperass - fixed, thanks
    @proenca A very useful function. Without it, you can try implementing it on your own - see the java solution.


  • 0
    S

    @awice I think you need to update the test cases. I wrote a code but forgot to check for keys, and still, it got accepted. For example S = "heeellooo" and w = "axxxrrzzz" works.


  • 0
    E

    I may misunderstand the description. My code failed in this test case:
    "dddiiiinnssssssoooo"
    ["dinnssoo","ddinso","ddiinnso","ddiinnssoo","ddiinso","dinsoo","ddiinsso","dinssoo","dinso"]

    My output is 1 but the answer is 3. I am a little confused. In my opinion, a word having only two 'd' like 'dd' or having having only one 'n' can not be counted. Because the length of a stretched group is at least 3. Obviously, there is only the first element "dinnssoo" that can be counted. Who can tell me that where the fault of my understanding is ? Many thanks.


  • 0
    E

    Sorry, just ignore my last post since I did not see the "discussion" tab where it should be.


Log in to reply
 

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