Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Log:
This is the input argument from the Top3 function:
"a a a b c c d d d d e e e e e
e e e e DDD ddd DdD: ddd ddd aa aA Aa, bb cc cC e e e
//wont won't won't
, e ..
...
' "
This is the error it generates:
Test Failed
Expected is <System.Collections.Generic.List
1[System.String]> with 0 elements, actual is <System.Collections.Generic.List
1[System.String]> with 1 elementsValues differ at index [0]
Extra: < "'" >
How can you possibly send an empty list if there is clearly multiple frequently used words in the input?
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.
test.assert_equals(top_3_words("3"), ["e", "ddd", "aa"])
I don't understand what this test is even for ???
help?
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.
This was a nice one to cool off with after dealing with finding the next bigger number permutation challenge.
Any anti-regex extremist that passed this problems should be awarded twice the points
Your answer isn't ordered.
it'd be nice if the rules about apostrophes were a bit more clear, but I think this a decent one. Not too difficult if I'm able to get past it!
I initially thought that apostrophes being next to each other wouldn't be allowed - like ab''ab is a valid word? bit strange.
Have you tested your own code at all? It fails some pretty basic stuff. Read the instructions, consider what sort of inputs there may be based on those instructions. It's not subtle. And/or make better observations for the tests you fail, since you already have failing cases there.
this is how you know that isn't happening. not unless the kata itself is COMPLETELY wrong. which it isn't. I and possibly several others confirm that a) you have a bug that isn't this (I looked at your code, and ran it, and debugged it) and b) this isn't happening
how are you reaching these conclusions? don't stop at sharing your conclusions if your conclusions seem wrong. state how you got there. maybe there's actually something that should be changed, even if it isn't what you think it might be.
I'm about to edit the python tests because it's got some things that bother me, but nothing that explains your experience. I won't make the test output more helpful because the kata is overranked so the least you can do is to carry out your own debugging, but if it's outright misleading then that's something I would want to change.
Everything you mentioned is specified in the section 'Assumptions'.
That is not the case. A word is every contiguous string of letters and apostrophes which is separated by one or more non-letters-or-apostrophes. You don't have to count substrings in a word.
So I've been trying to solve this for a few hours now, and I noticed that the meaning of "word" changes. For instance, in the non-random tests, we count the words as a person would when asked to count how many times X word comes up. Easy, enough.
This behavior is different because in the randomized tests, I've been given this string:
dugsksbdg ugpksps fsodkfnnshntloabcoadld dugsksbdg fsodkfnnslhpwkhtadld lvkjnk gngmt wbhsbfzrwadldhqucaadhlhpwkhthqucaadh lhpwkhtwbhsbfzrwmjcir'otfsodkfnnshqucaadhmjcir'otdugsksbdg mjcir'otmjcir'otugpkspsadldwyfwyf fsodkfnnsfsodkfnnsmjcir'ot ugpkspsd'jcktwiad'jcktwiawbhsbfzrwfsodkfnns wyffsodkfnns adldwyffsodkfnnslvkjnk dugsksbdgd'jcktwiawyfadld wbhsbfzrwdugsksbdg d'jcktwia d'jcktwiafsodkfnns lhpwkhtmjcir'othqucaadh dugsksbdg wyfugpkspswbhsbfzrw ugpksps lvkjnkadld adldhntloabcohntloabcodugsksbdgd'jcktwia wyfugpkspsfsodkfnns d'jcktwiaadld hntloabcodugsksbdgugpkspsfsodkfnns fsodkfnnsfsodkfnns adldugpksps wyflhpwkht fsodkfnns fsodkfnns fsodkfnnsadld ugpkspsugpksps dugsksbdg dugsksbdghntloabcohqucaadhmjcir'ot d'jcktwiawbhsbfzrwd'jcktwiawyf ugpkspswbhsbfzrwwyfwyfd'jcktwia wbhsbfzrwwbhsbfzrwwyflhpwkhthntloabcodugsksbdgwyf fsodkfnnsfsodkfnns wyflhpwkhtd'jcktwiahntloabcowbhsbfzrwhntloabcoadld lvkjnkwyfd'jcktwiaugpksps hlzcdukvoxlvkjnkhqucaadhugpkspshqucaadhhntloabco fsodkfnnsdugsksbdg lvkjnk d'jcktwiahntloabcougpkspsugpkspshqucaadhwbhsbfzrwfsodkfnns wbhsbfzrw dugsksbdgdugsksbdghqucaadhfsodkfnnsmjcir'ot adld ugpkspsadldugpkspsmjcir'otd'jcktwiaadlddugsksbdgwbhsbfzrwdugsksbdghlzcdukvoxhntloabco wyfdugsksbdghntloabcowbhsbfzrw d'jcktwia dugsksbdgd'jcktwiadugsksbdg hqucaadh lhpwkhthlzcdukvoxwyfhntloabco ugpkspshntloabcod'jcktwiawyfhntloabcofsodkfnnswbhsbfzrwdugsksbdgmjcir'otfsodkfnnswbhsbfzrwugpkspshntloabco hntloabcougpkspshntloabcodugsksbdg hntloabcofsodkfnns d'jcktwiagngmt wbhsbfzrwugpkspswbhsbfzrwwyfadldugpksps d'jcktwia d'jcktwialhpwkhtmjcir'otlhpwkht dugsksbdgwyf mjcir'otugpkspsfsodkfnnsfsodkfnnsdugsksbdghntloabcowyfdugsksbdg wyffsodkfnnsfsodkfnns d'jcktwiadugsksbdg d'jcktwiawyfadld hntloabco wbhsbfzrwhntloabcofsodkfnnsadld wyfmjcir'otlhpwkht wyfwbhsbfzrwdugsksbdgdugsksbdghntloabco d'jcktwiadugsksbdglhpwkhthlzcdukvox mjcir'ot
--
In this string, what I got wrong was that I didn't account for this 3-letter string: "wyf". The problem with this though is that "wyf" is not a standalone word. My "unique words" contained this string but it never occurred as a singular word.
The solution is basically like asking me to count the letter "e" from "Everybody likes ice cream", despite it never occurring as its own word.
Another problem I had was that if the word is actually a unique word on its own, you're basically no longer counting like a normal person would and have to count words by their substrings. This causes problems in the asserted tests because now instead of counting the amount of times "I" appears on its own in the paragraph test (and remember "words" are defined as case-insensitive), you are now counting the amount of times the letter "i" appears for every word in the string. This is a problem because what if "I" wans't in the top string?
Then there's the matter of substrings being counted as a singular word, which means in a sentence like this:
"My name is Sub and I'm eating a subway sandwich in a submarine playing subway surfers", the word "sub" appears 5 times, and the solution would agree.
Not a big issue, but 🗿
For the sake of completing this problem, you can just write some workaround so it's whatever but my main issue is the first point I brought up. I'm getting substrings considered as strings despite never appearing as one, and I have no idea what to about it.
Did you try printing the input as soon as you get it?
print
the input and other intermediate results to debug your code!Loading more items...