leetcode113专题

代码随想录 Leetcode113. 路径总和 II

题目: 代码(首刷看解析 2024年1月30日): class Solution {public:vector<int> temp;vector<vector<int>> res;void recursion(TreeNode* cur, int sum) {if (!cur->left && !cur->right && sum == 0){res.push_back(temp);

LeetCode113. Path Sum II 找出二叉树中总值为sum的所有路径 #算法# 第十一周

原题如下 Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum. Note: A leaf is a node with no children. Example: Given the below binary tree and sum =