Hey there replers! Last week, we announced the second weekly challenge and you can check it out by clicking here.
We'll get back to the results later. But first, this week's weekly challenge!
Another palindrome (but with strings)
So, for this week's challenge, we're taking things up a notch! And here's what you'll have to do.
- Get a string input from the user (only English alphabet will be given)
- Check if the inputted string is a palindrome.
- If the input is not a palindrome, check whether if it can be jumbled into another string that is a palindrome.
- The palindromic string does NOT have to be an actual word, just a random string.
- If it can be jumbled into a palindrome, print out the minimum number of steps required to turn the string into a palindrome.
(A step here refers to the process of swapping to adjacent characters in the string)
- If it cannot be jumbled into a palindrome, print out the number of characters, that can turn it into a palindrome by adding them to the end of the string.
NOTE : The 6th step is optional for those who want to give themselves more of a challenge.
For submitting your repls, you can just share them on the repl talk share board and be sure to keep
#WEEKLY in your post's title.
If you have any further questions, you can ask them via the comments section, and if you don't, I would still recommend going through the comments section as they may contains some extra information.
Moving on, the last week's challenge's results are here!
The top 3
RANK 1 : @Scoder12 with a total score of 17 points!
Some of the common mistakes from the last challenge were: -
- Did not handle negative numbers.
- When entering a negative number, the result comes out to be negative which isn't possible because the
number of digitscan never be negative.
- Only checked for palindromes higher than the number of digits.
If your score isn't mentioned here, you can find it out by DMing me on discord (@TheDrone7#1624) or by emailing me at [email protected]
That's it for this week folks, cya around next week!
@TheDrone7 how come you said that these were supposed to be beginner firendly, when you have now just completely thrown that away, people don't learn, string manipulation until later on, people don't learn things like this until quite a bit into coding. This is not beginner friendly anymore and hence, defeated the object of these really i think
@CodingCactus I would argue for loops are very beginner friendly. You can solve this problem with only loops I think. Well, I guess "beginner" is relative. I'm learning Java at my school now, and we haven't even talked about loops yet.
But I guess "beginner" means in the context of self taught coders.
@CodingCactus Well string manipulation can be really easy depending on the language you choose. For exemple, it is easy to take and move characters in a string using the python slicing. Personally, I still find these challenges beginner friendly, and though I haven't done it yet, I believe it can be done with simple vocabulary.