If you ever encountered yourself doing some practice on recursion, I’m quite sure you faced the Fibonacci sequence algorithm. If you are not familiar with this problem, take a look at what Wikipedia has to say about it:
In mathematics, the Fibonacci numbers, commonly denoted Fn, form a sequence called the Fibonacci sequence, such that each number is the sum of the two preceding ones.
So, if we start with 0 and 1, this is how the first N Fibonacci numbers look like:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ...
As you can see, each number…
You may already be familiar with the function
In this article, we are going to talk about how to create our own simplified version of this method, and learn how to improve its implementation step by step, covering more and more cases as we progress.
If you are not familiar with this function, let’s take a look at what MDN has to say about it:
Closures are something that many companies would like you to know before working for them, therefore, chances are they’ll ask you something related with this topic, or even more, they could make you write a practical example of it.
On this story, I’m gonna tell you about a small function I was asked…
On a recent technical interview I had for a big tech company, in one of the steps of the process I was asked the following:
“Cool”, I said to myself, that’s something I can achieve easily. The total time I had to develop that was 45 minutes, which at first looked more than enough.
I started doing the simplest thing I could imagine, mimicking what a normal clock or countdown does: at each 1-second interval, we would decrease the value of the counter by 1…