Skip to content

Commit efea5c6

Browse files
fix dynamic array in egg_dropping puzzle
1 parent 7984cd4 commit efea5c6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

dynamic_programming/egg_dropping_puzzle.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44

55
#include <climits>
66
#include <iostream>
7+
#include <vector>
78
using namespace std;
89

910
int eggDrop(int n, int k) {
10-
int eggFloor[n + 1][k + 1];
11+
std::vector<std::vector<int> > eggFloor;
12+
eggFloor.reserve(n + 1);
13+
1114
int result;
1215

1316
for (int i = 1; i <= n; i++) {

0 commit comments

Comments
 (0)