Weekly Challenge #17
Hello again replers! We just finished our fourth series of weekly challenges and at the end of a month, @minx28 who was ranked 1st received 1 month of free hacker plan.
Today, we'll be starting another series of the weekly challenges and again, at the end of the month, whoever has the highest score, gets 1 month of free hacker plan!
That's it for the recap, moving forward, this week's challenge is given below!
WARNING : This is no longer beginner friendly!
For those of you who don't know what it is, refer to this wikipedia page. The usual approach to calculating nth term of the series is either by using loops or recursion. For this week's challenge, you have to write a program that generates a user specified number of terms without using either of those 2 methods. No loops, no recursion.
The output only needs to have the Nth term.
Have fun with that one!
Are stdlib functions that might use looping or recursion behind the scenes allowed?
A : Yes. But if you use them, you will lose 3 points from however much you get.
Are external APIs or packages allowed?
A : NO!
For submitting your codes for this challenge, you need to create a new post on repl talk share board and ensure that the post title contains
#WEEKLY in it. The judging will go on throughout the week and as soon as the next post is made, the time window for submitting your code will end.
You can check out the last month's results here.
And that's it! Good luck with this week's weekly challenge and have fun!
You say we cannot use loops but can we use loops to set up an array? by doing that, we technically are not using loops to get the answer because we can just do:
System.out.println(fibonacciNumbers[n]); to get the answer. Will this be ok?
@AbhayBhat if you take an integer
n and set it to something like
Int n = 6, you can raise 10 to the power of n
Int o = Math.pow(10, n) (in Java), resulting in a number with
n + 1 digits in it, because we use base 10 counting, and if you multiply something by 10, it adds a zero at the end. Now if you turn this into a string and split it between each character
String p = o.toString().split(''); (in Java), it will create an array with
n+1 items in it.
Question: Can we look up stuff for help? I am still so noob, that I need loops & || recursion to get this...
Just for clarification:
- Absolutely no loops and recursion? Including list loops? (ex.
[n - 1 for n in range(num)])
- Python standard libraries such as math are allowed - correct?