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!
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(
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.
Here's my esoteric solution, leveraging the fact that for any number
a in base
a << 1 (append a 0 to the end) is
a * b.
Note: Only works if 2 <=
b<= 36, and both
bis an integer.
parseInt( a.toString(b) + '0', b );