Updates from the Repl.it team about the product

← Back to all posts
Weekly Challenge #2
h
TheDrone7 (1034)

Hello again fellow replers! Last week, we started our weekly challenges, check out that post by clicking here.


More guidelines

Today, I'm posting this week's challenge. But before that, a few more instructions that weren't mentioned in the last post.

  1. You are allowed to make only 1 submission. Only submit after you're completely sure about submitting your submission. Your score won't be updated once your submission is scored.
  2. If there is any sort of condition in which your submission does not satisfy the challenge's requirement, it's score will be 0.

And that's it! Now, let's get back to this week's weekly challenge.


Number of digits (but palindromic)!

Write a program that takes a numerical input (integer) from the user (for example: n). For all the numbers between 0 and n, count the number of digits in each of these numbers and get the total number of digits among all these numbers. Then find the number closest to the total number of digits such that the found number is a palindrome (for example: x) and print out x's value.

Example: -
INPUT : 20

PROCESS: -
Total = 0
For 0 to 9, number of digits = 1. Total = 1 * 10 = 10.

For 10 to 20, number of digits = 2. Total = 1 * 10 + 2 * 11 = 32.

Closest number to 32 that is also a palindrome = 33.

OUTPUT : 33

Again, for submitting your repls, post them on the share board and be sure to keep #WEEKLY in the 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.

Given below are the results for last week's weekly challenge.


WEEKLY CHALLENGE 1 - RESULTS

Rank 1 : @qsa with a perfect score of 10 points. Check out their submission here.

Rank 2 : @DynamicSquid with a score of 9 points. Check out their submission here.

Rank 3 : @sugarfi @Scoder12 @EthanHorowitz @Lord_Poseidon with a score of 8 points among all 4 users. The links to their submissions are given below.

@sugarfi : https://repl.it/talk/share/WEEKLY-Underscore-Edition/36190
@Scoder12 : https://repl.it/talk/share/WEEKLY-Challenges-1-Fractions-solution/36204
@EthanHorowitz : https://repl.it/talk/share/WEEKLY-1-Binary-By-Hand/36274
@Lord_Poseidon : https://repl.it/talk/share/WEEKLY-binary-arithmetic-because-why-not/36273

  1. During this challenge, we did allow submitting multiple times or updating your submissions but it won't be allowed from this week.
  2. We did not score the submissions which had errors.
    Two of the most common errors were - Division by 0 (For people doing inverse division) and Infinite recursion (When entering a negative number for those who used recursion).

And that's it! Good luck with this week's weekly challenge and have fun!


Commentshotnewtop
DynamicSquid (2611)

@TheDrone7 Oh, more more question (sry if I'm bombarding you with questions), if the input is 0, is the output 0 or 1? Because it says the numbers between 0 and n, but there are no numbers between 0 and 0, so would the output be 0?

TheDrone7 (1034)

No problems with the questions @DynamicSquid and the range is inclusive so among 0 and 0, there is 1 number i.e. 0 so the answer would be 1.

DynamicSquid (2611)

@TheDrone7 Oh, what about negative numbers?

TheDrone7 (1034)

You will have to take them into account. Although, the - symbol is not a valid digit. @DynamicSquid

DynamicSquid (2611)

@TheDrone7 Hey, I have a quick question. So at the start of today, I was at like 580 cycles, however, as soon as you posted this, I jumped to 700. And it's not only me seeing this, @johnstev111 also reports the same thing. So I was just wondering, is this glitch, or did you award me 120 cycles for coming in second place?

TheDrone7 (1034)

No, you were not awarded the cycles. You either received them or there is a bug. @DynamicSquid

DynamicSquid (2611)

@TheDrone7 yeah, I think it's a bug, cause I got like 120 cycles, and it's still rising, within a couple minutes. Who should I talk to about this?

firefish (305)

@DynamicSquid I found this on Repl Customs:
They are legitimate

DynamicSquid (2611)

@johnstev111 120 cycles in a couple minutes without posting anything? I think it's a bug.

DynamicSquid (2611)

@johnstev111 nope, I checked all my posts, none got any new upvotes

DynamicSquid (2611)

@johnstev111 no. and remember, I got 120 cycles in a couple minutes! that has to to a bug or glitch of somekind

firefish (305)

@DynamicSquid I don't know... speak to a mod...

firefish (305)

@DynamicSquid Speak to a mod... it's weird

bramley (194)

@DynamicSquid If you're a member of our Repl.it Discord, you can report it in #bugs. If you aren't, I believe you can email [email protected] or report here: https://repl.it/bugs

masfrost (110)

@bramley please don't advertise discord #bugs, it's not well monitored. Email and /bugs is great, thanks for sharing.

firefish (305)

@DynamicSquid You just lost 100 cycles... Those buggy cycles are gone

DynamicSquid (2611)

@johnstev111 yeah, and I'm continuing to lose them, hopefully it goes back down to the right number

firefish (305)

@DynamicSquid The 703 cycles was just a fluke then..

DynamicSquid (2611)

Closest as in a higher num, lower num, or both?

TheDrone7 (1034)

Closest means the closest, it can be higher or lower. If there's a higher and a lower palindromic number equally close, either is fine. @DynamicSquid

CodeLongAndPros (952)

Can you add more examples? It's not very clear what you want us to do.

TheDrone7 (1034)

If I add any more examples, it would pretty much reveal the entire solution. @CodeLongAndPros Although, if you have doubts about something specific, I would be glad to clarify.

CodeLongAndPros (952)

@TheDrone7

get the total number of digits among all these numbers

This would be for 11 then:
0-9 = 10*1; Total = 10
10 = 2*1; Total = 12

Closest palindrome: 11?

I just don't understand what you are trying to say.

ChezCoder (1479)

@CodeLongAndPros basically, count the amount of chars there are from 0 to INPUT, then find the closest palindrome to that number

So basically, if the user entered 20, (there are 32 digits from 0 to 20: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20), and the closest palindrome to that number would be 33

Aloeb83 (46)

@CodeLongAndPros You've got the idea, though the number of digits for your 11 example would actually be 14 since it would be 10-11 = 2*2.

DynamicSquid (2611)

Oh wow! I didn't except to get second place :)

CodingCactus (2749)

why is this pinned in announcements?

CodingCactus (2749)

@TheDrone7 huh, it was a few seconds ago (for me)

TylerBernardo (13)

How would you find every palindrome, since you would need every one to compare. I know you can find a palindrome based off a number, but those skip a lot of numbers.

AmazingMech2418 (691)

Where can we find what scores we got?

MatReiner (106)

i don't get what it's supposed to do other than a random algoritm...

StudentFires (340)

So, I presume my submission must've fallen into the category of "submissions which had errors"?

DynamicSquid (2611)

@ChezCoder wow, you love advertising :)

Oh, but the submissions aren't based on number of views or upvotes. the modes will eventually look at all of them :)

ChezCoder (1479)

@DynamicSquid lol sorry never meant to advertise. Also, your cycles are back to normal again!

DynamicSquid (2611)

@ChezCoder yup :) kinda glad that I don't have buggy cycles anymore

ChezCoder (1479)

@DynamicSquid lol but you also lost 200 cycles

DynamicSquid (2611)

@ChezCoder yeah lol, but I would rather have real cycles than buggy ones

DynamicSquid (2611)

@ChezCoder but it is kinda a cool feeling when your first in the 7-day leader board :)

ChezCoder (1479)

@DynamicSquid WAIT IM FIRST IN LEADERBOARD?? WTFFF

DynamicSquid (2611)

@ChezCoder those stop animation projects really gained you a lot of cycles :)

DynamicSquid (2611)

@ChezCoder and you're on your way to 800!

ChezCoder (1479)

@DynamicSquid definitely xD something just clicked inside my head

ChezCoder (1479)

@DynamicSquid ik XD earlier today, i was reloading the page and watching my cycle count go up, its depressing and exiting at the same time lol

DynamicSquid (2611)

@ChezCoder lol. and you made quite a few animations! you made three in 8 days! It takes me a week to make something...

ChezCoder (1479)

@DynamicSquid you are very good at flattery, here are some upvotes :D

ChezCoder (1479)

@DynamicSquid wow! congrats! you reached 600 :D

DynamicSquid (2611)

@ChezCoder yay! however I really need a break from cycles. I'm still working on my 500 cycles special lol

ChezCoder (1479)

@DynamicSquid oh lol. Im plan on only making my cycle specials like every 500 cycles, for example, my 500 cycle special, and my 1000 cycle special (which I very much hope will be coming soon!)

DynamicSquid (2611)

@ChezCoder yeah, I'm also thinking of doing that

HahaYes (1014)

Has my last challenge been graded?

TheDrone7 (1034)

All have been graded. @HahaYes but your scores won't be revealed if you didn't make it in the top 3.

ThatSmart (86)

Is the range inclusive or exclusive? Like if I enter 20 does it count 20?

ThatSmart (86)

@TheDrone7 What should I do if the number is equidistant from 2 palindromes?

TheDrone7 (1034)

Either of the two is fine. @ThatSmart

ThatSmart (86)

@TheDrone7 Alright. Maybe you should say that in the challenge, like 57 can return either 101 or 111?

ChezCoder (1479)

@TheDrone7 Will single digits count as palindromes?

ChezCoder (1479)

@TheDrone7 another question, would we need to count for decimals? if so, can the palindrome result be a decimal?

TheDrone7 (1034)

No, I specified integers meaning only positive or negative numbers without any decimal points. @ChezCoder

ChezCoder (1479)

@TheDrone7 when testing, will you enter decimals in the input?

PYer (3290)

Closest higher num, lower num, or both?

PYer (3290)

Yeah, I saw your comment and the response, and just submitted mine. @DynamicSquid

PYer (3290)

Ummmm, how do you come up with this?

TheDrone7 (1034)

I stole it from some websites I don't even remember. I browse through my school's Computer Science book, see a few activities, combine them and make a new challenge. @PYer

DynamicSquid (2611)

@TheDrone7 oh that's neat. and are you doing these challenges by yourself, or are you working with a team of mods?

TheDrone7 (1034)

@DynamicSquid Well all the moderators are free to choose whether or not they want to help with the judging but for now I'm doing this on my own. It's my job at repl.it

ChezCoder (1479)

@TheDrone7 can you clearify the 0 to n part? im confused due to your demonstration.

DynamicSquid (2611)

@ChezCoder if the input is 20, then count all the digits you see here:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

DynamicSquid (2611)

@ChezCoder

0 1 2 3 4 5 6 7 8 9 - that's 10 digits
10 11 12 13 14 15 16 17 18 19 20 - that's 22 digits

the total would be 32

ChezCoder (1479)

@DynamicSquid oh like count the number of chars

DynamicSquid (2611)

@ChezCoder oh quick question, how many cycles do I have?

DynamicSquid (2611)

@ChezCoder a couple minutes ago I had 580. this is definitely a bug/glitch. do you know how to contact a mod?

ChezCoder (1479)

@DynamicSquid try feedback/bugs? I don't know if its a bug, maybe people are upvoting your comments, etc, but congrats :D

lilykhan (124)

congrats to the winners! yeahhhhh!!!! <3

[deleted]

Egg

Coder100 (4006)

huh? Please clarify

AdCharity (1270)

I am obviously not in an interview