![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
文章平均质量分 50
yang蜗牛
中山大学16级数据科学与计算机学院软件工程硕士,研究方向为自然语言处理,基于深度学习的文本情感分析
展开
-
[leetcode] 1. twoSum; 167. Two Sum II - Input array is sorted; 15. threeSum; 16. 3Sum Closest; 18. 4
[leetcode] 1. twoSum; 167. Two Sum II - Input array is sorted; 15. threeSum; 16. 3Sum Closest; 18. 4Sum这篇文章涉及到leetcode中求和的相关题目。1. twoSum [Easy]Given an array of integers, return indices of the two numb原创 2017-02-26 15:35:25 · 588 阅读 · 0 评论 -
[leetcode] 85. Maximal Rectangle
Maximal Rectangle Given a 2D binary matrix filled with 0’s and 1’s, find the largest rectangle containing only 1’s and return its area. For example, given the following matrix: 1 0 1 0 0 1 0 1 1 1原创 2017-06-26 11:33:02 · 336 阅读 · 0 评论 -
[Leetcode] 57. Insert Interval
Insert Interval Given a set of non-overlapping intervals, insert a new interval into the intervals(merge if necessary). You may assume that the intervals were initially sorted according to their star原创 2017-06-26 10:49:53 · 375 阅读 · 0 评论 -
[leetcode] Median of Two Sorted Arrays
[4] Median of Two Sorted Arrays There are tow sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log(m+n原创 2017-06-03 12:05:54 · 620 阅读 · 0 评论 -
[Leetcode] 123. Best Time to Buy and Sell Stock III
123. Best Time to Buy and Sell Stock IIISay you have an array for which the i-th element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete at mos原创 2017-06-04 23:25:16 · 511 阅读 · 0 评论 -
[Leetcode]122. Best Time to Buy and Sell Stock II
122. Best Time to Buy and Sell Stock IISay you have an array for which the i-th element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many t原创 2017-06-04 22:36:16 · 672 阅读 · 0 评论 -
[Leetcode] 121. Best Time to Buy and Sell Stock
121. Best Time to Buy and Sell StockSay you have an array for which the i-th element is the price of a given stock on day i. if you were only permitted to complete at most one transaction(ie, buy one原创 2017-06-04 21:56:06 · 469 阅读 · 0 评论 -
[leetcode] 76. Minimum Window Substring
76. Minimum Window Substring题目:Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example, S = “ADOBECODEBANC” T = “ABC”原创 2017-05-08 09:52:41 · 432 阅读 · 0 评论 -
[leetcode] 567. Permutation in String
567. Permutation in StringGiven two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. In other words, one of the first string’s permutations is the substring of t原创 2017-05-07 20:52:32 · 3158 阅读 · 0 评论 -
[Leetcode] 41. First Missing Positive
41. First Missing PositiveGiven an unsorted integer array, find the first missing positive integer.For example, Given [1,2,0] return 3, and [3,4,-1,1] return 2.Your algorithm should run in O(n) time原创 2017-05-14 21:47:13 · 465 阅读 · 0 评论 -
[leetcode] 91. Decode Ways
91. Decode Ways题目A message containing letters from A-Z is being encoded to numbers using the following mapping:‘A’ -> 1 ‘B’ -> 2 … ‘Z’ -> 26 Given an encoded message containing digits, determine th原创 2017-04-23 19:15:50 · 318 阅读 · 0 评论 -
[lletcode]Word Break
Word Break题目:Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary words.原创 2017-04-23 18:46:49 · 402 阅读 · 0 评论 -
【leetcode】406. Queue Reconstruction by Height
406. Queue Reconstruction by Height题目Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the person and k is th原创 2017-03-26 21:01:07 · 366 阅读 · 0 评论 -
【Leetcode】Jump Game
55. Jump GameGiven an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determi原创 2017-04-02 23:06:08 · 356 阅读 · 0 评论 -
[leetcode] 64. Minimum Path Sum Add to List
64. Minimum Path Sum Add to ListGiven a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only m原创 2017-04-09 22:53:09 · 474 阅读 · 0 评论 -
【leetcode】133. Clone Graph
133. Clone Graph这道题目的意思是:对一个无向图进行深拷贝,即需要申请一个新的空间,并将原来的无向图中的节点及相关信息拷贝到这个新的空间。因此解题思路其实就是对这个无向图进行遍历,并且一边遍历一边深拷贝即可。对于无向图的遍历,可以采用深度遍历(DFS)和广度遍历(BFS)完成,两者的时间复杂度和空间复杂度都是O(n)。方法一:深度遍历(DFS)// Definition for un原创 2017-03-12 21:02:51 · 616 阅读 · 0 评论 -
[leetcode] 491. Increasing Subsequences
Given an integer array, your task is to find all the different possible increasing subsequences of the given array, and the length of an increasing subsequence should be at least 2 .Example: Input: [4原创 2017-03-19 17:22:14 · 1589 阅读 · 0 评论 -
【leetcode】215. Kth Largest Element in an Array
【leetcode】215. Kth Largest Element in an ArrayFind the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example,原创 2017-03-06 01:06:18 · 408 阅读 · 0 评论 -
[leetcode] 91. Decode Ways
91. Decode Ways A message containing letters from A-Z is being encoded to numbers using the following mapping: ‘A’ -> 1 ‘B’ -> 2… … ‘Z’ -> 26 Given an encoded message containing digits,原创 2017-06-26 11:52:01 · 694 阅读 · 0 评论