7 kyu

Common Substrings

176 of 2,166Shivo
Description
Loading description...
Strings
Algorithms
  • Please sign in or sign up to leave a comment.
  • ejini战神 Avatar

    Java:

    • method name should be camelCase, not PascalCase

    Refer here on how to enable backward compatability to not invalidate all solutions

  • tdjohnson72373 Avatar

    Im getting this error message when I attempt with Javascript:

    ReferenceError: SubstringTest is not defined at /home/codewarrior/index.js:24:63 at /home/codewarrior/index.js:70:5 at Object.handleError

    I dont think there is anything I can change prevent the error. I dont have access to index.js. My solution passes the test cases and works in my IDE.

  • LetMeDie Avatar

    I came across such a problem on leetcode. And his level was definitely higher than easy

  • PurpleKaz81 Avatar

    This is a level 7?

  • Wartem Avatar

    Shorter description:

    Given two strings, determine if there is a common substring longer than one letter.

    Return true if found, false if not. Case-insensitive.

  • trashy_incel Avatar

    C translation (author gone)

  • ejini战神 Avatar

    JS:

    • Node 18. (mocha + chai) should be enabled

    • function name should use camelCase

  • andreapt82 Avatar

    Very poor description. What is "common"?

  • user9644768 Avatar

    Ruby 3.0 should be enabled.

  • FArekkusu Avatar

    Python 3 should be enabled.

  • Sega Avatar

    This comment has been hidden.

  • quangnd Avatar

    This kata is not easy! I've lost 60 minutes but still can't resolve it! Actually, I finished all test case except a test case with very long string.

    Frustrated! :(

  • knasim Avatar

    Please provide the test criteria for randTests, ReversetOfExample, and MediumString. I'm getting the follwoing but don't know how to further troubleshoot this.

    randTests(KataTest) expected: but was:

    ReverseOfExample(KataTest) expected: but was:

    MediumString(KataTest) expected: but was:

  • l2010 Avatar

    Hello, I am also having an issue with the randtest. I initially posted too much of my code, but I am not sure how to resolve that issue. Initially, I thought it involved non-alpahabetic characters, but I still received the error message. Can anyone offer suggestions on what types of things are being tested in the randtest?

  • novdar Avatar

    Hi! Please change name of the method to camelCase style (in Java kata). It hurts my eyes.

  • puma8384 Avatar

    What does the randTest test? I have 10 of 11 test correct except this test. Has this "rand" something to do with the edge of the String. I do not test for single letters but after the description I dont need to. Certainly I miss to test certain strings but by the name of the test I do not get a hint what I miss.

  • ArturSkowronski Avatar

    clojure.set wasn't working for me in this kata. I had a exception when tried to require it

  • samitnuk Avatar

    Python, Basic Tests: "False should equal True" for Test.assert_equals(substring_test("supercalifragilisticexpialidocious","SoundOfItIsAtrocious"), True) str2 has "n" and str1 has not. So should be False. Please fix.

  • bkaes Avatar

    The random tests in Haskell are overly verbose. Instead, use

    it "should work for random input" $ property $   
      forAll (fmap (take 2500) $ listOf1 $ choose ('a', 'z')) $ \lst1 ->
      forAll (fmap (take 200)  $ listOf1 $ choose ('a', 'z')) $ \lst2 ->    
        substringTest lst1 lst2 `shouldBe` substringTestSol lst1 lst2
    
  • g964 Avatar

    Haskell translation kumited.

  • Shivo Avatar

    Everything should now have random test cases.

  • Darnor Avatar

    Minor issue with the Java version:

    public static boolean SubstringTest(string str1, string str2)
    

    should be:

    public static boolean SubstringTest(String str1, String str2)
    

    For future Java katas:

    Method name should start with a lowercase letter SubstringTest(...) -> substringTest(...) to follow the Java style guidelines but that would invalidate all current solutions, so just fixing the string -> String will do.

    Random tests:

    Some random tests would be nice, as at least one solution just checks if a specified test value is present and returns the wanted result....

    Cheers

  • g964 Avatar

    Clojure translation kumited.

  • Shivo Avatar

    "In the Python random tests for: substring_test('sNFiT3qmsnQwAMeXzzP','3UqW') I returned True (because of Qw and qW) but the test failed; it was said that I should have returned False. Maybe you should have a look?"

  • g964 Avatar

    Coffeescript translation kumited.

  • g964 Avatar

    In the Python random tests for: substring_test('sNFiT3qmsnQwAMeXzzP','3UqW') I returned True (because of Qw and qW) but the test failed; it was said that I should have returned False. Maybe you should have a look?

  • GiacomoSorbi Avatar

    Translated, also with sweet one-liners with an eye to performances ;)

    Also: this kata is very close to being approved, so when you see it with a green bar, feel free to post below here to ask me for it to be fully greenlit :)