7 kyu
Lorraine Wants to Win the TV Contest
500 of 827raulbc777
Loading description...
Fundamentals
Algorithms
Data Structures
View
Career Accelerator
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.
'global word_list' is unnecessary in python. Able to access word_list without that line.
python new test framework is required. updated in this fork
Approved!
This comment has been hidden.
I find this part highly misleading and I think it's simply not necessary, potentially qualifying for removal.
Tests seem to have no performance requirements whatsoever, I managed to pass JS and Python version with a simplest, least performant solution possible, constantly re-sorting everything all over.
The kata would be really nice if it required some form of preprocessing, indexing, whatever. Given as it is now, it's just a duplicate to Arrh, grabscrab! and Where my anagrams at?.
Javascript, Python: tests are not structured correctly: nested
it
blocks cause messy, red/green output.This kata is a subject to deduplication process here: https://github.com/codewars/content-issues/issues/101.
Please join the discussion to share your opinions, and help us identify duplicate kata and retire them.
This smells like a duplicate of an existing kata, plus the issue below, it should be retired !!!
[JavaScript] Unless I am seriously mistaken, random tests are completely broken which render the Kata uncompletable. My solution pass all fixed tests but keep getting errors like the below for random tests:
I deliberately added
console.log
statements in my solution to determine whether my solution is being called before the error occurs, and that seems to not be the case since I see no console output (from my function) in the random tests, but they appear as normal in the fixed tests. I also added'use strict'
directive at the beginning of my function body to ensure that any undeclared variables in my solution will throw an error in the fixed tests, and my solution still passes the fixed tests as expected.Please investigate.
This comment has been hidden.
setting global variable word = '' and returning undefined from function passes 220 tests but not 3 simple tests.. (actually the 3 simple tests are modifiable. Not submitting on this one.)
Should be fixed.
The actual value should be normalized before testing (sorted at least).
Python 3 should be enabled.
This comment has been hidden.
Congrats to 11k!
I received only congrats from 7k and above! :)
And you received your own C#-Kata! :-)
Thanks a lot Steffen for your kind words!
It's taking a very long time to run this and it's not letting me pass. Test cases are passing in 25ms but I'm still getting "Process was terminated. It took longer than 6000ms to complete". I've been held back too many times because of this message. It passes 55 tests then stops running. I've only written 8 lines of code.
I assume you're using bruteforce/permutations approach, it was my first idea too. But actual solution turned out to be suprisingly (to me, at least) less complicated.
PEP8: Constants are usually defined on a module level and written in all capital letters with underscores separating words. Examples include MAX_OVERFLOW and TOTAL .
My suggestion: word_list == WORD_LIST
I rewrote the description (not perfect but fixed a couple grammar/spelling mistakes and shortened it a bit). You will need to add in proper formatting again with the contest rules as a list, etc.
There are many word games that can help to make our minds more agile. Many TV programs, in different countries, use them as entertainment for the audience.
Lorraine had tried to win one of them many times but she was not successful in her attempts. The TV contest is as follows:
The TV show host gives a random caller a scrambled word (that is incomprehensible) and by rearranging those letters they have to discover a word that is in the Oxford English Dictionary. They have only 25 seconds to discover the word.
Her friend Bruce obtained the list of 2000, frequently used, English words used by the TV show.
Help Lorraine by making a function that will the give her a list of all valid words that may be obtained by rearranging the scrambled word. There always be at least one valid word for each test case.
Let's see some test cases:
unscramble("shi") == ['his']
unscramble("nowk") == ['know']
unscramble("amle") == ['male', 'meal']
The list of words that Bruce obtained (keep the secret!) is named WORD_LIST. For words with more than six letters we have a challenge with speed. Try to create a suitable memoized data structure for fast hashing using the provided WORD_LIST.
Remember that all the words will correspond to U.K. English (Oxford Dictionary).
If your code works well and fast, Lorraine will be very thankful.
Thanks a lot @zebulan for your interest in improving the katas of our community. I read the rewritten description and I liked it. That's why you will see the updated description almost equal to the one you suggested me, except only word, the name of our list of words. It's a constant, not a variable, you're right but will produce that all the solutions submitted previously will be rejected. I'll take this important point for next katas as I took some advices you gave me before. Thanks for your time and I appreciate your help.
No problem, thanks for all your work making so many interesting katas!