6 kyu
Count word occurrences
265 of 268Uraza
Loading description...
Strings
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
This comment has been hidden.
Passed: 24 Failed: 0 Exit Code: 1 Shows timeout...is there a catch to the Kata that I have missed ?
Nevermind... my bad didn't read the instructions carefully.
I pass the test cases. But when I submit I get 'TypeError: Cannot call method 'count' of undefined' and I really don't understand why. Can someone please give me a hint about what I'm doing wrong?
Your solution should be written inside the wordCounter function initially provided by the kata: is that what you did?
Hi, nice Kata! But, I have the issue with last test case: "should not count punctuation as words". Could you please specify input text and word? After that i could figure out why my solution not passed. Many thanks!
This comment has been hidden.
Weird thing. My solution works with every test but it's rejected because it takes more than 6000 ms. That doesn't happen when I try my code in the browser console (it takes less than 1 sec with the long text "I am a bad bad bad algorithm because I do not use a cache...").
This comment has been hidden.
:o I didn't understand well, but now I did. Thank you for you reply. I just have finished the kata.
This comment has been hidden.
You are mean! :)
Some random tests have been added.
You are not testing if our implementations are using cache to avoid calculate
count
for already caculated word counts.Hi.
There was a "performance" test but it was apparently not sufficient for your solution to time out.
I have slightly modified this test case, it should be good now.
Thanks for pointing that out! :)
Yeah, thats solve the issue... but I have a new issue for you. I'm going to post it. We keep talking :)
Question is quite simple, probably level 7, but the means of calling it are over complex. Why not simply have a function with (str1, str2) and check if str1 is inside of str2?
The idea is to have the count performed once when setting up the
wordCounter
, instead of computing that information each time thecount
method is called.Good job. A couple of minor suggestions:
word
that is just punctuation, however.WordCounter
towordCounter
. A common convention says that when the first letter is capitalised, the function is a constructor, which could cause confusion.Thanks for your valuable feedbacks, the code and description have been updated.