Ad
  • Custom User Avatar

    Test Failed
    Expected and actual are both <System.Collections.Generic.List`1[System.String]> with 3 elements
    Values differ at index [1]
    Expected string length 1 but was 0. Strings differ at index 0.
    Expected: "d"
    But was: <string.Empty>
    -----------^

    What is this actually saying?

  • Default User Avatar

    The "Ties may be broken arbitrarily." is broken in C#. The last random test generates error because of it. After like 10 time running the tests, RNG was on my side and I passed the test ... Someone else suggested tie breaker should be alphabetical, which would make a lot more sense imo.

  • Custom User Avatar

    Maybe specify on the "other characters" part a bit more. If the problem wanted me to avoid ANY character outside of the parameters it sure used a poor example and poor test cases.

  • Default User Avatar

    Hi all! I have some questions about the requirements that have to be met:

    1. What does "Ties may be broken arbitrarily" mean exactly? What are ties in this context and how can they be broken (arbitrarily)? Could you give an example?
    2. In what order should we return words which occur an equal amount of times? / Does the order matter?
    3. It seems like my solution is failing on the random tests (partly?) because substrings of what I assumed to be words already count as words. Does a word not have to be enclosed by whitespaces to be a word? So is e.g. the simple string 'a' already a valid word and would therefore be counted 3 times in the text "a shadow in the dark"?
      I apologize for repeating questions which have been asked before by members of the community. Unfortunately, I was not able to find satisfactory answers to those questions. Thanks for your help :)
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    The test cases should include the '_' character. The random tests include them while the test cases don't. This is important since this is the difference between /W and [a-z].

    (I can't find how to remove commenents and forgot to label it properly)

  • Custom User Avatar

    Lacks tests for words that begin in apostrophe.

    //Apostrophes can appear at the start, middle or end of a word ('abc, abc', 'abc', ab'c are all valid)
    Assert.AreEqual(new List { "'abc", "abc'", "'abc'" }, TopWords.Top3("'abc, abc', 'abc', ab'c"));

  • Custom User Avatar
  • Default User Avatar

    I pass the first tests but when I attempt it fails on this:

    [Incorrect match: words not present in the string.]

    I am not sure what it means, could anybody give me an example?

  • Custom User Avatar

    The sample tests pass OK but I'm pretty confident as written there's an issue with the randomly generated tests. For the following input:

    hKxhqGKw vZbByUFiuiNVvZbNyxueiWFWdOaiO NLBB vZb vZbFqOWNZYjuaEuiNV X'LIQQr MhKQDNZ MlmgKBuNyxu X'LIQQr NyxuX'LIQQr vZb vZb X'LIQQrvZbhKxhqGKw JQilHATveiWFWdOaiOMhKQDNZoDv MlmgKBu MlmgKBu X'LIQQrNyxu uiNVMhKQDNZhKxhqGKw MhKQDNZNyxu uiNVByUFi MhKQDNZ MhKQDNZ hKxhqGKw uiNV MlmgKBuvZb MlmgKBu FqOWNZY oDv uiNVoDv JQilHATv hKxhqGKw ExwqMcPEPLRURVEJQilHATv MhKQDNZ X'LIQQrjuaE JQilHATv MhKQDNZX'LIQQr ByUFi MlmgKBu ByUFiNLBB uiNV uiNVX'LIQQr hKxhqGKwhKxhqGKw FqOWNZY NyxueiWFWdOaiOjuaEuiNVX'LIQQrJQilHATvJQilHATvMlmgKBu X'LIQQrJQilHATv JQilHATv FqOWNZYvZb FqOWNZYByUFi vZbhKxhqGKwNLBBFqOWNZYX'LIQQr Nyxu JQilHATv JQilHATveiWFWdOaiOoDvoDv NyxuuiNVByUFi MhKQDNZJQilHATv eiWFWdOaiO NyxuNyxuuiNV juaE juaENyxuX'LIQQr vZbvZb FqOWNZYeiWFWdOaiOoDvuiNVvZbMhKQDNZjuaEX'LIQQr JQilHATv MlmgKBu JQilHATv ByUFi NyxuNyxu vZb ExwqM MlmgKBu uiNV FqOWNZYhKxhqGKwuiNV MhKQDNZJQilHATv MhKQDNZ uiNVeiWFWdOaiONLBBFqOWNZYuiNVuiNVNyxu vZb vZb MlmgKBu MlmgKBu ByUFi MlmgKBu hKxhqGKw cPEPLRURVE JQilHATvvZbNyxuFqOWNZYMhKQDNZMhKQDNZ NyxuJQilHATvuiNVNyxu oDv JQilHATvvZbuiNV eiWFWdOaiO X'LIQQrX'LIQQrjuaE Nyxu JQilHATv FqOWNZYJQilHATv FqOWNZY FqOWNZYjuaEJQilHATv Nyxu X'LIQQr NLBB X'LIQQrFqOWNZY uiNV uiNVMhKQDNZvZb X'LIQQrvZbByUFijuaE uiNV MlmgKBu vZb vZbuiNV NLBBvZbFqOWNZYvZbX'LIQQr JQilHATvMhKQDNZJQilHATvJQilHATv MlmgKBuuiNV vZbMhKQDNZ X'LIQQr vZb FqOWNZY MlmgKBu X'LIQQr FqOWNZYoDv uiNV MlmgKBuhKxhqGKwvZb vZb JQilHATveiWFWdOaiOJQilHATvByUFi JQilHATvMhKQDNZ uiNV FqOWNZYNyxu ByUFiNyxuMhKQDNZ X'LIQQrvZb X'LIQQrJQilHATvNLBBFqOWNZYX'LIQQrByUFiX'LIQQrhKxhqGKw MhKQDNZByUFi oDvJQilHATv X'LIQQrMlmgKBu MlmgKBu uiNVX'LIQQroDvhKxhqGKw MhKQDNZJQilHATvJQilHATvMlmgKBu Nyxu X'LIQQrMhKQDNZhKxhqGKwX'LIQQr hKxhqGKw eiWFWdOaiO MlmgKBu vZbuiNV FqOWNZY

    I get:

    Incorrect frequencies expected:<[30, 30, 29]> but was:<[20, 30, 30]>

    Looking at my output one of my words with a frequency of 30 above is vZb. My program calculates this as occuring 7 times, not 30. The string vZb does indeed occur 30 times, but sometimes as a substring of another word. Occuring as a substring doesn't really fit the definition of a word.

    To illustrate this the introductory example of In a village of... has a sample output of ["a", "of", "on"]. Based on the logic the test appears to be following on should be in 2nd place as it occurs 8 times to of's 5 times.

  • Custom User Avatar

    It is unclear why one apostrophe "'" or three apostrophes "'''" are not a word if "Apostrophes can appear at the start, middle or end of a word" and a word consists of "letters (A to Z) optionally containing one or more apostrophes". Stating clearly the rule that "a word must contain at least one letter" would improve the description.

    It is also unclear from the current description, if a word can contain two adjacent apostrophes.

  • Default User Avatar

    Aimed for solving this including the "Bonus Points" and ended up with a rather dirty solution that uses a cache for the top3.
    (to be honest, I am not even sure how this actually performs against just splitting the string directly and ordering the list in the end...)

    Obviously the top solutions are much more elegant, but I wonder if the lazy evaluation in Linq is actually able to fulfill "Avoid sorting the entire array of unique words." ?

    Is there any way to do this elegantly while still getting both "Bonus Points"?

  • Loading more items...