From 077e265de3b79ed7e9646f9fb53279ba94fd53d2 Mon Sep 17 00:00:00 2001 From: Mattrixwv Date: Sat, 11 Jul 2020 13:36:34 -0400 Subject: [PATCH] Updated function to match description --- Algorithms.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Algorithms.hpp b/Algorithms.hpp index dda606d..548b5e2 100644 --- a/Algorithms.hpp +++ b/Algorithms.hpp @@ -343,7 +343,7 @@ std::vector getAllFib(const T num){ tempNums[0] = tempNums[1] = 1; //Do the calculation and add each number to the vector - for(T cnt = 2;(tempNums[(cnt - 1) % 3] < num) && (tempNums[(cnt - 1) % 3] >= tempNums[(cnt - 2) % 3]);++cnt){ + for(T cnt = 2;(tempNums[(cnt - 1) % 3] <= num) && (tempNums[(cnt - 1) % 3] >= tempNums[(cnt - 2) % 3]);++cnt){ tempNums[cnt % 3] = tempNums[(cnt + 1) % 3] + tempNums[(cnt + 2) % 3]; fibList.push_back(tempNums[cnt % 3]); }