From a96b65cbfad7f62f3db6b2eab105e4e25c0414c5 Mon Sep 17 00:00:00 2001 From: Jack Sangdahl Date: Fri, 27 Jun 2025 12:23:02 -0600 Subject: chore: remove old cpp and rust solutions --- other/min_path_sum.cpp | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 other/min_path_sum.cpp (limited to 'other/min_path_sum.cpp') diff --git a/other/min_path_sum.cpp b/other/min_path_sum.cpp deleted file mode 100644 index 46c2ff1..0000000 --- a/other/min_path_sum.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// 64. Minimum Path Sum -#include "leetcode.h" - -// given 'm x n grid' filled with non-negative numbers, find a path from top -// left to bottom right, which minimises the sum of all numbers along its path - -class Solution { -public: - int minPathSum(vvd & grid) { - int m = grid.size(), n = grid[0].size(); - vvd sum(m, vector(n, grid[0][0])); - for (int i = 1; i < m; i++) - sum[i][0] = sum[i - 1][0] + grid[i][0]; - for (int j = 1; j < n; j++) - sum[0][j] = sum[0][j - 1] + grid[0][j]; - for (int i = 1; i < m; i++) - for (int j = 1; j < n; j++) - sum[i][j] = min(sum[i - 1][j], sum[i][j - 1]) + grid[i][j]; - return sum[m - 1][n - 1]; - } -}; - -int main() { - Solution obj; - vvd g1 = {{1, 3, 1}, {1, 5, 1}, {4, 2, 1}}; - vvd g2 = {{1, 2, 3}, {4, 5, 6}}; - printf("%d\n", obj.minPathSum(g1)); // expect: 7 - printf("%d\n", obj.minPathSum(g2)); // expect: 12 -} -- cgit v1.2.3