mirror of
https://bitbucket.org/Mattrixwv/my-classes.git
synced 2026-02-03 19:02:28 -05:00
Fixed bug in getNumFib where you get one number larger than desired
This commit is contained in:
@@ -347,6 +347,9 @@ std::vector<T> getAllFib(const T num){
|
|||||||
fibList.push_back(tempNums[cnt % 3]);
|
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 the vector that contains all of the Fibonacci numbers
|
||||||
return fibList;
|
return fibList;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user