Leetcode
Huangyanxl
这个作者很懒,什么都没留下…
展开
-
Leetcode 495 Teemo Attacking
In LLP world, there is a hero called Teemo and his attacking can make his enemy Ashe be in poisoned condition. Now, given the Teemo's attacking ascending time series towards Ashe and the poisoning tim原创 2017-02-26 19:06:14 · 350 阅读 · 0 评论 -
Leetcode 94 Binary Tree Inorder Traversal
Q:Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree [1,null,2,3], 1 \ 2 / 3return [1,3,2].A:/*原创 2017-07-05 20:50:29 · 401 阅读 · 0 评论 -
Leetcode 207 Course Schedule
Q:There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is express原创 2017-06-26 00:20:46 · 203 阅读 · 0 评论 -
Leetcode 104 Maximum Depth of Binary Tree
Q:Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.A:/** * Definition for原创 2017-06-25 23:44:25 · 170 阅读 · 0 评论 -
leetcode 513 Find Bottom Left Tree Value
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * };原创 2017-06-23 15:24:14 · 296 阅读 · 0 评论 -
Leetcode 257 Binary Tree Paths
Q:Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \2 3 \ 5All root-to-leaf paths are:["1->2->5", "1->3"]原创 2017-07-12 00:42:45 · 210 阅读 · 0 评论 -
Leetcode 332 Reconstruct Itinerary
class Solution {public: vector findItinerary(vector> ticket) { vector itinerary; if(ticket.size()==0){ return itinerary;} map> map;原创 2017-06-21 21:50:36 · 349 阅读 · 0 评论 -
Leetcode 53 Maximum Subarray
class Solution {public: int maxSubArray(vector& nums) { int maxSub1 = nums[0] + nums[1]; int maxSub2 = nums[0]; int both; int s1, s2; int add; for(int i = 0;原创 2017-03-13 20:36:27 · 199 阅读 · 0 评论 -
Leetcode 169 Majority Element
class Solution {public: int majorityElement(vector& nums) { int majEle; int count = 0; for(int i = 0; i if(count == 0) { majEle = nums[i]; count++;原创 2017-04-04 12:44:33 · 406 阅读 · 0 评论 -
Leetcode 199 Binary Tree Right Side View
Q:Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.For example:Given the following binary tree,原创 2017-07-06 11:58:09 · 189 阅读 · 0 评论