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/max_sum_binary_tree.cpp | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 other/max_sum_binary_tree.cpp (limited to 'other/max_sum_binary_tree.cpp') diff --git a/other/max_sum_binary_tree.cpp b/other/max_sum_binary_tree.cpp deleted file mode 100644 index 64d1d20..0000000 --- a/other/max_sum_binary_tree.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// 1161. Maximum Level Sum of a Binary Tree -#include "leetcode.h" - -/* - * given the 'root' of a binary tree, the level of its root is 1, the level of - * its children is 2, and so on. return the smallest level 'x' such that the sum - * of all the values of nodes at level 'x' is maximal. - */ - -class Solution { - vector sums; - void dfs(TreeNode *root, size_t level) { - if (root) { - sums.resize(max(sums.size(), level)); - sums[level - 1] += root->val; - dfs(root->left, level + 1); - dfs(root->right, level + 1); - } - } - -public: - int maxLevelSum(TreeNode *root) { - dfs(root, 1); - return distance(begin(sums), max_element(begin(sums), end(sums))) + 1; - } -}; -- cgit v1.2.3