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/bt_max_path_sum.cpp | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 other/bt_max_path_sum.cpp (limited to 'other/bt_max_path_sum.cpp') diff --git a/other/bt_max_path_sum.cpp b/other/bt_max_path_sum.cpp deleted file mode 100644 index ff39808..0000000 --- a/other/bt_max_path_sum.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// 124. Binary Tree Maximum Path Sum -#include "leetcode.h" - -/* - * a path in a binary tree is a sequence of nodes where each pair of adjacent - * nodes in the sequence has an edge connecting them. a node can only appear in - * the sequence at most once. note that the path does not need to pass through - * the root. the path sum of a path is the sum of the node's value in the path. - * given the 'root' of a binary tree, return the maximum path sum of any non - * empty path - */ - -class Solution { -public: - int sum; - int maxPathSum(TreeNode *root) { - sum = INT_MIN; - solve(root); - return sum; - } - -private: - int solve(TreeNode *root) { - if (!root) - return 0; - int left = max(0, solve(root->left)); - int right = max(0, solve(root->right)); - sum = max(sum, left + right + root->val); - return max(left, right) + root->val; - } -}; -- cgit v1.2.3