原文:【leetcode】1302. Deepest Leaves Sum

题目如下: Given a binary tree, return the sum of values of its deepest leaves. Example : Constraints: The number of nodes in the tree is between and . The value of nodes is between and . 解题思路:我的方法是做两次遍历,第 ...

2019-12-29 08:58 0 224 推荐指数:

查看详情

[LeetCode] Sum of Left Leaves 左子叶之和

Find the sum of all left leaves in a given binary tree. Example: 这道题让我们求一棵二叉树的所有左子叶的和,那么看到这道题我们知道这肯定是考二叉树的遍历问题,那么最简洁的写法肯定是用递归,由于我们只需要累加左子叶 ...

Fri Sep 30 21:40:00 CST 2016 1 7986
[leetcode]Two Sum @ Python

原题地址:http://oj.leetcode.com/problems/two-sum/ 题意:找出数组numbers中的两个数,它们的和为给定的一个数target,并返回这两个数的索引,注意这里的索引不是数组下标,而是数组下标加1。比如numbers={2,7,11,17}; target ...

Tue Apr 29 20:43:00 CST 2014 0 23740
[leetcode]4Sum @ Python

原题地址:http://oj.leetcode.com/problems/4sum/ 题意:从数组中找到4个数,使它们的和为target。要求去重,可能有多组解,需要都找出来。 解题思路:一开始想要像3Sum那样去解题,时间复杂度为O(N^3),可无论怎么写都是Time Limited ...

Tue Apr 29 23:46:00 CST 2014 2 6046
[LeetCode] Path Sum

Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum ...

Tue Nov 13 19:57:00 CST 2012 0 5090
[LeetCode] Two Sum

Given an array of integers, find two numbers such that they add up to a specific target number. The ...

Fri Nov 16 05:15:00 CST 2012 3 2972
LeetCode 3Sum Closest

Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three ...

Sun Oct 28 02:03:00 CST 2012 1 5482
[LeetCode] Combination Sum

Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C wher ...

Tue Oct 30 01:20:00 CST 2012 0 4011
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM