Can you help explain this failure?
I was idly going through some of the earlier euler questions again in python. I have done these before, but I thought I would compare the answers I came up with now, to the answers I came up with two years ago to see if there was any difference. I haven't opened the old ones for some time, and Ill come back to those in time.
Anyway - I blabber on. I ran accross an odd thing today whilst looking at euler problem 2.
Compare the two functions fiblisteven 1 and 2. They are both supposed to take a target number, create a fibbonacci list up to a target number, and return the even values.
My tests run with a target number of 10, and the question asks for 4000000. but running the tests up to 10 fiblisteven1 always returns a 5 in the answer.
fiblisteven2 allows the test to pass, and has no speed penalty. but does have a memory penalty. But I cant figure out what is happening to make the first attempt not work. Any help?
Anyway - I blabber on. I ran accross an odd thing today whilst looking at euler problem 2.
Compare the two functions fiblisteven 1 and 2. They are both supposed to take a target number, create a fibbonacci list up to a target number, and return the even values.
My tests run with a target number of 10, and the question asks for 4000000. but running the tests up to 10 fiblisteven1 always returns a 5 in the answer.
fiblisteven2 allows the test to pass, and has no speed penalty. but does have a memory penalty. But I cant figure out what is happening to make the first attempt not work. Any help?
Comments
Post a Comment