![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
文章平均质量分 63
HwasinR
这个作者很懒,什么都没留下…
展开
-
124. Binary Tree Maximum Path Sum
Given a non-empty binary tree, find the maximum path sum.For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connections...原创 2018-05-27 22:02:46 · 329 阅读 · 0 评论 -
114. Flatten Binary Tree to Linked List
class Solution {public: void Core(TreeNode* root) { int flag = 0; if (root->left != NULL && (root->left->left != NULL || root->left->right != NULL)) Core(root->lef...原创 2018-09-01 20:36:07 · 119 阅读 · 0 评论 -
148. Sort List
Sort a linked list in O(n log n) time using constant space complexity.Example 1:Input: 4->2->1->3Output: 1->2->3->4Example 2:Input: -1->5->3->4->0Output: -1-...原创 2018-08-28 17:55:08 · 94 阅读 · 0 评论 -
149. Max Points on a Line
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.Example 1:Input: [[1,1],[2,2],[3,3]]Output: 3Explanation:^|| o| o| o +-----...原创 2018-08-30 16:29:00 · 116 阅读 · 0 评论 -
438. Find All Anagrams in a String
Given a string s and a non-empty string p, find all the start indices of p's anagrams in s.Strings consists of lowercase English letters only and the length of both strings s and p will not be larger ...原创 2018-06-09 11:33:01 · 135 阅读 · 0 评论 -
543. Diameter of Binary Tree
Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path between any two nodes in a tree. This path may or may n...原创 2018-06-09 10:47:39 · 146 阅读 · 0 评论 -
394. Decode String
Given an encoded string, return it's decoded string.The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. Note that k is guara...原创 2018-06-09 10:27:43 · 134 阅读 · 0 评论 -
11. Container With Most Water
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two ...原创 2018-06-01 17:58:07 · 120 阅读 · 1 评论 -
312. Burst Balloons
Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all the balloons. If the you burst balloon i you will get nums[le...原创 2018-05-29 11:56:48 · 150 阅读 · 0 评论 -
338. Counting Bits
Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array.Example:For num = 5 you sho...原创 2018-06-04 10:38:51 · 101 阅读 · 0 评论 -
315. Count of Smaller Numbers After Self
You are given an integer array nums and you have to return a new counts array. The counts array has the property where counts[i] is the number of smaller elements to the right of nums[i].Example:Input...原创 2018-06-04 10:12:59 · 197 阅读 · 0 评论 -
538. Convert BST to Greater Tree
Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum of all keys greater than the original key in BST.Example:...原创 2018-06-04 09:20:39 · 88 阅读 · 0 评论 -
309. Best Time to Buy and Sell Stock with Cooldown
题目如下:Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy o...原创 2018-05-24 22:35:15 · 86 阅读 · 0 评论 -
94. Binary Tree Inorder Traversal
Given a binary tree, return the inorder traversal of its nodes' values.Example:Input: [1,null,2,3] 1 \ 2 / 3Output: [1,3,2]Follow up: Recursive solution is trivial, could you do i...原创 2018-05-25 22:30:02 · 127 阅读 · 0 评论 -
102. Binary Tree Level Order Traversal
Given a binary tree, return the level order traversal of its nodes' values. (i.e, from left to right, level by level).For example:Given binary tree [3,9,20,null,null,15,7], 3 / \ 9 20 / ...原创 2018-05-26 11:25:54 · 87 阅读 · 0 评论 -
143. Reorder List
Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You may not modify the values in the list's nodes, only nodes itself may be changed.Example 1:Given 1->2-...原创 2018-08-30 11:23:19 · 92 阅读 · 0 评论