Retired
Palindrome (retired)
240nielsup
Loading description...
Fundamentals
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.
Only a small issue:
My solution only kept letters, and removed both special characters AND numbers (despite the description stating numbers matters). However, it still passed all the tests. I don't think this is intentional.
Duplicate of many other katas.
I've retired this kata due to this fact.
One letter test is needed ("0981428 a 9203084"). Even number of letters case is recommended ("ABBA"); Empty string case is needed ("9732908071280", also string.Empty). "Miss by one" examples are needed ("xaxa", "bummud").
I think this kata would be better with another name like 'special palindrome' or 'ninja palindrome', given that it contains some exceptions, also as @parabola949 says, try to improve the description.
This comment has been hidden.
Update description a little more, adding punctuation: Given a word or a sentence, determine if the inverse of the word or sentence is the same as the original. Only letters and numbers matter; ignore special characters and white spaces.
For instance: < a not e
Since you specified letters and numbers, it would also be good to have some test cases with numbers
Test methods: GivenAInvlidPalindromeWithSpecialCharactersOutputShouldBeFalse These are very difficult to read. Would it not be easier to use the string parameter of Assert.AreEqual? Assert.AreEqual(false, Kata.IsPalindrome("Hello ./?!@#$%^&*(){}[];'\|<>,"), "Invalid case with special characters should return false."); Then have a single test method?
The soloution from user bryjamus managed to pass. So test cases like "abca" are missing. Where first and last letter are the same but is still not a palindrome.
public static bool IsPalindrome(string w) { var arr = w.ToLower().ToArray().Where(x=>Char.IsLetter(x)); return arr.First() == arr.Last(); }
I've added a extra testcase for even length words. Thanks for the feedback.
You are right. I don't understand instructions in 100%. I correct solution.
I have passed all but the last (valid special character test) However, I'm having difficulty debugging because there is no example anywhere of what a 'special character' is, and neither can I see the actual test in the test description.
I've added the test cases with the special characters to the sample test cases. Hope this will help.
Thanks for adding! However, the change doesn't show up in my sample test spots. Do I have to reload soemthign?
This very similar to http://www.codewars.com/kata/53046ceefe87e4905e00072a/train/javascript.
You're right, should i delete this one or what do you suggest?
Can this be splitted into multiple lines? It's hard to read this line due to missing formatting.
I've changed the description. Thanks for the feedback.