knaxus/problem-solving-javascript

Handling fibonacci for negative numbers and 0

PoojaKhandhadia opened this issue ยท 7 comments

Function fibonacciTabular is not handled if a negative number is provided. It returns undefined as output.

If 0 is given as index in fibonacciTabular it returns 0 instead of 1.

@ashokdey For the functions fibonacci and fibonacciMemoized if negative numbers are provided the output is coming as 1. Is it correct to handle in such a way that the output should be 1 or it should be handled that the output comes as 0?

@ashokdey I would like to work on this issue.

Thanks @PoojaKhandhadia, I really appreciate your skills and efforts. I would also like to know whether you are interested to be a full-time maintainer of this project putting more stress on Unit Tests?

Also thank you @SumeetHaryani, your PR #33 has fixed this. I am looping in @TheSTL for cross-validation before I close this.

It should throw error if index is negative.
And Fibonacci series start from 0,1,1,2,3........

@ashokdey Sounds great!! Thanks for this. I would love to take this up!!!

Great @PoojaKhandhadia, please drop me a mail with your contact details and availability for this task here: ad@ashokdey.in ๐ŸŽ‰

@ashokdey @TheSTL I was just going through this.... the current change returns the negative number itself instead of error.

@PoojaKhandhadia working on it, will raise PR soon.