Fix a bug in pingala.cpp
This commit is contained in:
@@ -15,7 +15,7 @@ std::vector<std::string> generate_triangle(const size_t depth)
|
||||
std::vector<size_t> items;
|
||||
std::stringstream ss;
|
||||
levels.reserve(depth);
|
||||
items.reserve(depth * depth);
|
||||
items.resize(depth * depth);
|
||||
|
||||
#define AT(i, j) items[((i) * depth) + (j)]
|
||||
AT(0, 0) = 1;
|
||||
@@ -58,6 +58,7 @@ int main(int argc, char *argv[])
|
||||
goto error;
|
||||
|
||||
levels = generate_triangle(depth);
|
||||
|
||||
for (const auto &level : levels)
|
||||
{
|
||||
for (size_t i = 0;
|
||||
|
||||
Reference in New Issue
Block a user