7 kyu

Lorraine Wants to Win the TV Contest

500 of 827raulbc777
Description
Loading description...
Fundamentals
Algorithms
Data Structures
  • Please sign in or sign up to leave a comment.
  • PythonPro123 Avatar

    'global word_list' is unnecessary in python. Able to access word_list without that line.

  • saudiGuy Avatar

    python new test framework is required. updated in this fork

  • mohdmujtabaa Avatar

    This comment has been hidden.

  • hobovsky Avatar

    Try to create a suitable memoized data structure for fast hashing using the provided word_list .

    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?.

  • hobovsky Avatar

    Javascript, Python: tests are not structured correctly: nested it blocks cause messy, red/green output.

  • hobovsky Avatar

    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.

  • ejini战神 Avatar

    This smells like a duplicate of an existing kata, plus the issue below, it should be retired !!!

  • donaldsebleung Avatar

    [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:

    ReferenceError: word is not defined
        at givePerm
        at /home/codewarrior/index.js:335:30
        at begin
        at it
        at /home/codewarrior/index.js:333:13
        at begin
        at it
        at /home/codewarrior/index.js:330:3
        at /runner/frameworks/javascript/cw-2.js:152:11
        at Promise._execute
        at Promise._resolveFromExecutor
        at new Promise
        at describe
        at /home/codewarrior/index.js:329:1
        at /home/codewarrior/index.js:347:5
        at Object.handleError
    

    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.

  • FArekkusu Avatar

    The actual value should be normalized before testing (sorted at least).

  • FArekkusu Avatar

    Python 3 should be enabled.

  • Robin-Andrews Avatar

    This comment has been hidden.

  • user5036852 Avatar

    Congrats to 11k!

  • Adrian1707 Avatar

    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.

  • zebulan Avatar

    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.