6 kyu
Divide into palindromes
129 of 139igorlukjanov05
Loading description...
Algorithms
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.
JS Translation added
Good kata, but the task description could mean too many different things. What's really bad is that both "smallest" and "largest" are used, but they are to be considered in a different context:
It would be much better to pick one of the examples in the description, and show us the different divisions, the "smallest" palindrome in each division, and the "largest" of those "smallest" ones.
I'm logging this as issue, as time and again users have complained about this in the comments and I feel the description is still below par.
updated description
Cool and original!
Nice!
Maybe could you improve a bit your description by changing :
by
The details really needs some more explanation. It's really only clear what's expected from the examples/test cases.
E.g. why should I not consider
'aaaaa'
as 5 palindromes ('a | a | a | a | a'
) but as a single 5-length palindrome? There is a rule you're not explainingBecause our task is to shuffle and split our line into the smallest number of palindromes, so that the length of the smallest is the largest. If we have the line
"aaaaa"
, the best way for us is to consider it as a single palindrome, because the answer 5 is greater than 1.That's what I mean - you should explain that in the description.
Specifically you should mention that people need to make "the smallest number of palindromes" before they solve for the "smallest palindrome"
Fixed tests shouldn't rely on the reference solution.
and how is that an issue, exactly...? In the current context, the user cannot access it in any way, nothing mutable in the inputs...? Really, I don't see the issue in there. Merely a suggestion...
I left solution there, because it's my first kata and i dont know how to make it in another way :D Another reason why i left it there - warriors can take a look on it :D
.
Nothing was fixed.
Because I don't see anything to fix.
Yeah, going to have to agree with FArekkusu here.
Tests are not a great place for complete indirection. They are a great place for a mix of meaningful concrete values and random values.
Fixed tests should be able to survive even if a bug got introduced. That is not necessarily even by you, the author. It could happen from some future power user trying to fix something edge case, or trying to bump the language runtime or something.
Use
random.choices
for generating inputs.Thanks, done.
when a task looks unsolvable it means that's about time to start using math great kata!
If a letter is the smallest palindrome possible, why wouldn't every solution just be 1?
We need to shuffle and divide the line into the smallest number of the largest palindromes we can.
All I'm saying is that I tried to read the letter "C" backwards once and I ended up in the hospital for three days. Thinking about when I tried sorting and reodering it gives me immediate PTSD...
I get the idea now and thanks for posting the Kata. There's people more intelligent than I am out there arguing whether a single letter should be palindromic or not akin to whether 1 is a prime number.
well, reversing the string isn't looking at it in a mirror, so... I don't see any good reason to harm yourself like that. ;)
I'm not sure I understand the task.
In the example given, the answer is
aba|c|ede
and the minimum length is 1. Your task is to shuffle and divide this line into a number of palindromes so that the length of the minimum palindrome was the maximum. Maximum of what?it would help if you can you give more examples of how you get/split the examples test cases:
Thanks.
Check the updated description.
👍
use the new test framework
Test cases have been updated.
Hi,
->
bacabbacab
=> full length. Either your code is wrong, or there is constraint you didn't talk about in the description.Cheers
Sorry, my bad