7 kyu

Single character palindromes II

285 of 772KenKamau
Description
Loading description...
Algorithms
  • Please sign in or sign up to leave a comment.
  • saudiGuy Avatar

    python new test framework is required. updated in this fork

  • Cloud Walker Avatar

    Good kata but more like a 6 kyu. A single letter can be considered a palindrome but then my solution would fail.

  • balu9 Avatar

    This should be a 6 kyu

  • JayYay Avatar

    Isn't "abcba" already a palindrome? ("abc-" && "-cba" ("abc" inverted)) If so, why is it true? If not, can someone rectify the misunderstanding? Thank you!

  • freeman42x Avatar

    Could you update the test cases so that when they fail it is possible to tell what argument was passed? eg.:

    main = hspec $ do describe "Single Character Palindromes II" $ do it "abba" $ do solve "abba" shouldBe False it "abbaa" $ do solve "abbaa" shouldBe True it "abbx" $ do solve "abbx" shouldBe True it "aa" $ do solve "aa" shouldBe False it "ab" $ do solve "ab" shouldBe True it "abcba" $ do solve "abcba" shouldBe True

    Thank you

    • KenKamau Avatar

      Issue or suggestion?

      Issue marked resolved by KenKamau 7 years ago
    • freeman42x Avatar

      This comment has been hidden.

    • KenKamau Avatar

      How? Its not standard practice. Or is it?

    • freeman42x Avatar

      The way it currently works is that it fails and you can't tell which test failed. You can keep it this way, but it is just added extra-difficulty - your choice.

    • KenKamau Avatar

      So it was in fact a suggestion..

    • freeman42x Avatar

      From my PoV it is an issue because the tests are not properly implemented. But if that is part of the difficulty - it is ok. Would be better to mention that in the description. But not mentioning it can also be considered as part of the increased difficulty.

    • KenKamau Avatar

      This is a first for me, someone saying that tests are not properly implemented in 1/75 of my katas. I will wait for more issues like this before I touch it.

    • freeman42x Avatar

      I explained why they are not properly implemented: "The way it currently works is that it fails and you can't tell which test failed." Do you need more than 1 person to tell you something is wrong to fix it - even though that is obviously so?

    • KenKamau Avatar

      It's not that..I simply don't agree with you. Thanks though.

  • JohanWiltink Avatar

    Description should mention there will be no testing with odd length palindromes.

    ( Alternatively, improve testing. )

  • Voile Avatar

    As mentioned here, there's an edge case that should be considered.

    • KenKamau Avatar

      I have updated the description to deal with this case. All palindrome strings should be False. This avoids many complications.

      If Ok, close.

    • myjinxin2015 Avatar

      But, it seems that the length of your random string always be even number. So, some solution like my old one still can pass your tests.

    • KenKamau Avatar

      Help me understand.

      s1 = "abba" s2 = "abccba"

      These are even length palindromes. I don't think it's possible to change one character and get a palindrome. Do you have a scenario that yields a palindrome?

    • Blind4Basics Avatar

      As said by Voile before, just follow the link and you'll find myjinxin suggestion:

      Test.assertEquals(solve("abcba"),true);
      because "c" can changed to any letter, the string still be a palindrome.
      

      Currently, this type of case is not covered by your tests. Neither the fixed ones, nor the random ones since you effectively only generate strings of even length.

    • KenKamau Avatar

      I've improved testing. Both odd and even length palindromes tested.

      Please close if OK.

    • KenKamau Avatar

      So, this issue has been addressed. Can we close?

    • Blind4Basics Avatar

      all good, closed.

      Issue marked resolved by Blind4Basics 7 years ago
    • KenKamau Avatar

      7kyu? Really B4B? Avg is 6.

    • Blind4Basics Avatar

      Your estimation was 7 and power users average was 7 too. That's why. ;)

    • KenKamau Avatar

      Average is 6. My ranking doesn't count towards that. I think 6 is fair. This is too hard for 7.

    • Blind4Basics Avatar

      Yes, your ranking counts. If not, there wouldn't be the possibility to choose that. ;) I had 3 available information: 2x7kyu, 1x6kyu. Average: 7kyu. That's the "normal procedure", I just applied it.

      7 seems approriate to me (yes, 6,5 would be better, but we do not have that). If others think it's more appropriate to rank it as 6 too, though, I'll change the rank.

    • JohanWiltink Avatar

      This comment has been hidden.