Skip to content
Sign upLog in
← Back to Community

WEEKLY CHALLENGES #1

Profile icon
TheDrone7Hacker

Hello all replers! Today, I'm going to be announcing something new and fun for you all. We're introducing WEEKLY CHALLENGES!.

So, what are these weekly challenges? These are small beginner-friendly programming problems for the community to solve. We will be posting one of these every week. After 1 week of posting the challenge, we'll stop accepting any answers for the current challenge and post a new one, (although, you can still solve these for fun or just to learn something new).

And, what's in it for me? We will grade your submissions for each challenge you attempt. By the end of the month, the person to have the highest total score will be awarded 1 month of free hacker plan!!

HOW DO I SUBMIT? You can submit your answers by sharing the repls to the share board of repl talk and ensure that the name of the post contains #WEEKLY (in all caps, this will help us filter your submissions).

Now that all the introductions are done, let's get to the point, i.e. this week's weekly challenge!


Multiplication!


For this week's weekly challenge, you will need to write a program that multiplies 2 numbers. BUT, there's a twist. You are NOT ALLOWED to use the multiplication operator (*) or loops(for, while or any other that your prefered language may support, goto also counts as a loop). You cannot use any external libraries and anything else is allowed.

QUICK NOTE : Since these challenges are very easy, this should be obvious but we will not only be judging your output but also your code. The actual marking scheme will remain hidden though.

Voters
Profile icon
WhitneyWallace1
Profile icon
wulmaopomy267
Profile icon
jacksmolenski
Profile icon
otrotazo
Profile icon
darksideofthero
Profile icon
Avxak
Profile icon
ancoder
Profile icon
jwdjen
Profile icon
whovian44
Profile icon
hyperupcall
Comments
hotnewtop
Profile icon
KobeFF

In LOLCODE can you use the PRODUCKT function?

Profile icon
HackermonDev

What if you already have hacker plan? Will they change the expiring date of the hacker plan?

Profile icon
HahaYes

@PDanielY
They will probably wait for it to expire then give you an extra month

Profile icon
yummypasta

Here's my esoteric solution, leveraging the fact that for any number a in base b, a << 1 (append a 0 to the end) is a * b.

Note: Only works if 2 <= b <= 36, and both a and b is an integer.

parseInt( a.toString(b) + '0', b );
Profile icon
AgastyaSandhuja

can you use a module where you can just do

mathmodule.multiply(a,b)
Profile icon
IceBlueWolfy

@AgastyaSandhuja
i would assume no becouse in that it uses the * but i could be wrong

Profile icon
NoelB33

Lol

@AgastyaSandhuja

Profile icon
AgastyaSandhuja

lol

@IceWolfy1

Profile icon
Coder100

not allowed hacker lmao


@AgastyaSandhuja

Profile icon
TheDrone7

NO

@AgastyaSandhuja
there should be no use of any multiplication operator or loops or external modules.

Profile icon
AgastyaSandhuja

ok lol

@TheDrone7

Profile icon
Nifley

I found you

@Coder100
😏

Profile icon
Coder100

😳

@Nifley

Profile icon
dotcomboom
x = 69 y = 420 z = round(x / (1 / y)) print(z)

dude python lmao

Profile icon
eric_wang

@dotcomboom
you might need to count for the zerodivisionerror edge case, in the event that y is 0.

Profile icon
dotcomboom

@eric_wang Good point, here's my updated version:

def multiply(x, y): if y == 0: return 0 return round(x / (1 / y)) print(multiply(69, 420))
Profile icon
Scoder12

Awesome free hacker plan here I come

Profile icon
hyperupcall

are multiple submissions valid?

@TheDrone7

Profile icon
PYer

same. I have 3 ideas already...

@eankeen

Profile icon
TheDrone7

No

@eankeen
. You may only make one submission. Submit the one you think will score the highest ;)

Profile icon
hyperupcall

@TheDrone7
yass okay thanks

Profile icon
PYer

okay

@TheDrone7

Profile icon
Lord_Poseidon

do recursive functions count as loops?

Profile icon
TheDrone7

No, they don't. @Lord_Poseidon

Profile icon
Lord_Poseidon

@TheDrone7
YEET. I already cooked up a dumb method involving map, strings, lists and binary arithmetic. Are multiple submissions allowed?

Profile icon
TheDrone7

No @Lord_Poseidon only submit the one you think will score the most.

Profile icon
Lord_Poseidon

without even knowing how code is judged? This is sad :(

Profile icon
AtriDey

Can I use automation plugins? Not a math plugin, but a mouse mover.

Profile icon
Coder100

lol what do you need a mouse for XD
pyautogui doesn't work on repl.it :(

@AtriDey

Profile icon
AtriDey

@Coder100
autopy works without a hitch.

Profile icon
JackFly26

if i do it in brainf can i use loops

Profile icon
Coder100

no

@ThatSmart

Profile icon
AtriDey

So there can be no loops in a code file (py, cpp, js, etc)
And does the math have to be done in the program?
CMON CODEMONKEY TOOK MY IDEA I NEED A LOOPHOLE NOW!

Profile icon
Codemonkey51

:)

@AtriDey

Profile icon
NoelB33

Well, he never said it has to be done in a code file...

@AtriDey

Profile icon
ABDOABDO11

const multiply=require("multiplier");
function multiple(num1, num2){
return multiply(num1, num2);

}
console.log(multiple(5, 5))

Profile icon
ChezCoder

will python chr() and eval() work?

Profile icon
TheDrone7

chr - yes. eval - no.

@ChezCoder

Profile icon
ChezCoder

@TheDrone7
oh ok

Profile icon
eartharoid

https://repl.it/@eartharoid/WEEKLY-1
not sure if an interval counts as a loop
probably a terrible way to do it, but it works. :)

Profile icon
TheDrone7

Intervals do count as loops.

@eartharoid

Profile icon
eartharoid

@TheDrone7
:(

Profile icon
ChezCoder
Profile icon
ChezCoder

@TheDrone7

Profile icon
DynamicSquid

Quick question, can I use for_each()? Not to multiply the number directly, but it's for a list

Profile icon
TheDrone7

Nope

@DynamicSquid
no loops allowed.

Profile icon
DynamicSquid

Wait, so I can still use #include <something>, right?

Profile icon
AtriDey

@DynamicSquid
I haven't touched C++ in a while, but I think header files count as external libraries. Idk, it's up to
@TheDrone7
.

Profile icon
DynamicSquid

@AtriDey
but like, i'm assuming we can use iostream, so I think
@TheDrone7
is referring to things withing the standard namespace

Profile icon
AtriDey

@DynamicSquid
Yeah, no iostream is sorta harsh. Since stdio.h is also a header, I guess some exceptions have to be made. I guess we wait for
@TheDrone7
.

Profile icon
AmazingMech2418

@DynamicSquid
iostream and iomanip should be allowed (or in C, stdio and stdlib), but I think others that add functionality to the language that is not required (sorry, I think maybe even vector) are not allowed.

Profile icon
TheDrone7

You can use any modules from the standard library of the language, just not external modules that don't come built in with the language.

@AmazingMech2418

Profile icon
TheDrone7

Standard library is totally fine.

@AtriDey

Profile icon
DynamicSquid

@TheDrone7
ah, cool, thanks

Profile icon
BenjaminUrquhar

Everyone's doing double division. Be more creative smh.

Profile icon
CodingCactus

@BenjaminUrquhar
it's the fastest way to solve the problem, would you ever want a slow function in your program if you can have a fast one that does the same thing?

Profile icon
BenjaminUrquhar

@CodingCactus
I'm not going for efficiency. If I was I'd just use the multiplication operator directly.

Profile icon
AmazingMech2418

@BenjaminUrquhar
I personally prefer string-based math for this one...

Profile icon
PYer