diff options
| author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2025-10-27 00:20:46 +0000 |
|---|---|---|
| committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2025-10-27 00:20:46 +0000 |
| commit | 8ee90f0d06baf15f4779c705c1e2863d586ba375 (patch) | |
| tree | e29e2958b644102c89bcde03b506e77084aa6246 /impls | |
| parent | 449d15c1c7344ab3b598b53c15b4a86963b36583 (diff) | |
| download | algorithms-8ee90f0d06baf15f4779c705c1e2863d586ba375.tar.gz algorithms-8ee90f0d06baf15f4779c705c1e2863d586ba375.tar.bz2 algorithms-8ee90f0d06baf15f4779c705c1e2863d586ba375.zip | |
Fix a bug in pingala.cpp
Diffstat (limited to 'impls')
| -rw-r--r-- | impls/pingala.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/impls/pingala.cpp b/impls/pingala.cpp index 97d3017..dc14f60 100644 --- a/impls/pingala.cpp +++ b/impls/pingala.cpp @@ -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; |
