Updates from the Repl.it team about the product

← Back to all posts
Weekly challenges #3
TheDrone7 (1034)

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.

  1. Get a string input from the user (only English alphabet will be given)
  2. Check if the inputted string is a palindrome.
  3. If the input is not a palindrome, check whether if it can be jumbled into another string that is a palindrome.
  4. The palindromic string does NOT have to be an actual word, just a random string.
  5. 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)
  6. 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!

RANK 2 : @CodingCactus and @XanderEhlert with a total score of 16 points!

RANK 3 : @Lord_Poseidon and @a5rocks with a total score of 15 points!

Some of the common mistakes from the last challenge were: -

  1. Did not handle negative numbers.
  2. When entering a negative number, the result comes out to be negative which isn't possible because the number of digits can never be negative.
  3. 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!

ThatSmart (86)

Does it have to be fast?

oignons (250)

Can I do the challenge even if I haven't done the previous ones?

RohilPatel (802)

What do you mean by 'steps' in step 5?

TheDrone7 (1034)

@RohilPatel It's written right there - swapping adjacent characters = 1 step

DynamicSquid (2611)

When you say case insensitive, does that mean that if you input a string with upercase, I can return a string with lowercase?

Also, are spaces allowed?

TheDrone7 (1034)

You can, although, I'll not be entering anything in mixed cases anyways. @DynamicSquid

darknew (17)

Are special characters allowed in the input? For exemple, is this a palindrome: Bob.? Or should we remove punctuation?

TheDrone7 (1034)

There will only be English alphabet in the input, so you don't really need to handle it but if you do, it's just a bonus for yourself. @darknew

theangryepicbanana (1630)

For step 6, is this for the original string or the palindromic-ish string?


can you give an example for the number of steps required to make it a palindrome. I don't quite understand.

would abab --> 1?

a5rocks (787)

Question: are palindromes case insensitive?

For example, is Racecar a palindrome? Or is only racecar a palindrome?

ThatSmart (86)

So what are the outputs for if it is a palindrome?

TheDrone7 (1034)

Just say something like you entered a palindrome @ThatSmart

CodingCactus (2750)

I thought these were supposed to be beginner challenges?

CodingCactus (2750)

what if they did input a palindrome, do you just say that they have inputted one and end the program?

CodingCactus (2750)

@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

TheDrone7 (1034)

This doesn't necessarily need string manipulation, it can still be solved using only beginner friendly stuff like for loops. You only need to figure out the solution and you have an entire week to do it. It has to be challenging too to be a challenge. @CodingCactus

CodingCactus (2750)

@TheDrone7 for loops are not beginner stuff, I don't know how you learnt, but that is the last thing that you learn in my school

ThatSmart (86)

@CodingCactus one of the first ones in mine

CodingCactus (2750)

@ThatSmart so before you learnt variables, data types and while loops, you learnt for loops?

CodingCactus (2750)

@TheDrone7 you deleted your comment?

I saw it anyway, this is pretty much the order that I learnt python:


CodingCactus (2750)

but libraries were like at the start, I just put them at the bottom as they didn't fit anywhere else

ThatSmart (86)

@CodingCactus before data types and while loops yeah

DynamicSquid (2611)

@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 (2750)

@DynamicSquid you're learning java, so you are a java beginner right? Can you solve this using java?

DynamicSquid (2611)

@CodingCactus You know, this made me realize, school is slow at teaching coding. I've been learning Java for 8 months now and I've learned variables, and a bit about functions. And that's it

darknew (17)

@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.

ChezCoder (1479)

@DynamicSquid same, we started at september and learnt python turtle, then just restarted with regular python... 2.7 :/

darknew (17)

@CodingCactus Well I started typescript and deno this morning, and I try to do this challenge in Deno

CodingCactus (2750)

@darknew lol, everyone is hating on me, I'm just saying that no one in my class that has being doing python for 2 years can do it(except me)