leetcode
Andreadyx
这个作者很懒,什么都没留下…
展开
-
Leetcode-1 Two Sum
题目如下:Given an array of integers, returnindicesof the two numbers such that they add up to a specific target.You may assume that each input would haveexactlyone solution, and you may not use th...原创 2019-03-26 20:33:36 · 125 阅读 · 0 评论 -
Leetcode-337 House Robber III
337.House Robber IIIMedium176635FavoriteShareThe thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the root, each h...原创 2019-09-24 09:26:39 · 141 阅读 · 0 评论 -
Leetcode-238 Product of Array Except Self
Given an arraynumsofnintegers wheren> 1, return an arrayoutputsuch thatoutput[i]is equal to the product of all the elements ofnumsexceptnums[i].Example:Input: [1,2,3,4]Output: [...原创 2019-03-26 21:53:59 · 203 阅读 · 0 评论 -
Leetcode-169 Majority Element
Given an array of sizen, find the majority element. The majority element is the element that appearsmore than⌊ n/2 ⌋times.You may assume that the array is non-empty and the majority element alwa...原创 2019-03-26 21:49:44 · 150 阅读 · 0 评论 -
Leetcode-121 Best Time to Buy and Sell Stock
Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (i.e., buy one and sell one share of the stock),...原创 2019-03-26 21:42:50 · 179 阅读 · 0 评论 -
Leetcode-122 Best Time to Buy and Sell Stock II
Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (i.e., buy on...原创 2019-03-26 21:39:00 · 216 阅读 · 0 评论 -
Leetcode-66 Plus One
Given anon-emptyarray of digitsrepresenting a non-negative integer, plus one to the integer.The digits are stored such that the most significant digit is at the head of the list, and each element...原创 2019-03-26 21:34:52 · 226 阅读 · 0 评论 -
Leetcode-15 3Sum
Given an arraynumsofnintegers, are there elementsa,b,cinnumssuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:The solution set must not conta...原创 2019-03-26 21:27:28 · 131 阅读 · 0 评论 -
Leetcode-561 Array Partition I
Given an array of2nintegers, your task is to group these integers intonpairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as poss...原创 2019-03-26 21:23:06 · 148 阅读 · 0 评论 -
Leetcode-53 Maximum Subarray
Given an integer arraynums, find the contiguous subarray(containing at least one number) which has the largest sum and return its sum.Example:Input: [-2,1,-3,4,-1,2,1,-5,4],Output: 6Explanat...原创 2019-03-26 21:06:51 · 154 阅读 · 0 评论 -
Leetcode-11 Container With Most Water
Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints of lineiis at (i,ai) and (i, 0). Find two...原创 2019-03-26 20:55:35 · 154 阅读 · 0 评论 -
Leetcode-951 Flip Equivalent Binary Trees
951.Flip Equivalent Binary TreesMedium32413FavoriteShareFor a binary tree T, we can define a flip operation as follows: choose any node, and swap the left and right child subtrees.A binary tr...原创 2019-09-24 20:10:40 · 138 阅读 · 0 评论