From ccebe26aa21650604a10c2c49fe50e52a524a09c Mon Sep 17 00:00:00 2001 From: Mattrixwv Date: Thu, 28 Feb 2019 11:22:58 -0500 Subject: [PATCH] Fixed bug in getNumFib where you get one number larger than desired --- Algorithms.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Algorithms.hpp b/Algorithms.hpp index 6c1aa78..a0d869c 100644 --- a/Algorithms.hpp +++ b/Algorithms.hpp @@ -347,6 +347,9 @@ std::vector getAllFib(const T num){ fibList.push_back(tempNums[cnt % 3]); } + //If you triggered the exit statement you have one more element than you need + fibList.pop_back(); + //Return the vector that contains all of the Fibonacci numbers return fibList; }