diff --git a/38. Minimum Path Sum/main.cc b/38. Minimum Path Sum/main.cc new file mode 100644 index 0000000..9f719e5 --- /dev/null +++ b/38. Minimum Path Sum/main.cc @@ -0,0 +1,10 @@ +#include "solution.h" +#include + +int main() +{ + std::vector > vec{{0,2,1,5,2,6,9},{3,5,4,7,4,3,8},{6,9,3,8,5,7,0}}; + Solution s; + std::cout << s.minPathSum(vec) << std::endl; + return 0; +} diff --git a/38. Minimum Path Sum/solution.h b/38. Minimum Path Sum/solution.h new file mode 100644 index 0000000..ef8f086 --- /dev/null +++ b/38. Minimum Path Sum/solution.h @@ -0,0 +1,17 @@ +#include +#include + +using std::vector; + +class Solution { +public: + int minPathSum(vector > &grid) { + for (decltype(grid.size()) i=0; i