随笔分类 -  LeetCode

摘要:题意: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. Subscribe to see which companies asked this ques 阅读全文
posted @ 2016-08-27 12:53 Gu Feiyang 阅读(114) 评论(0) 推荐(0)
摘要:题意: Implement a basic calculator to evaluate a simple expression string. The expression string contains only non-negative integers, +, -, *, / operato 阅读全文
posted @ 2016-08-09 00:14 Gu Feiyang 阅读(123) 评论(0) 推荐(0)
摘要:题意: Given a complete binary tree, count the number of nodes. Definition of a complete binary tree from Wikipedia:In a complete binary tree every level 阅读全文
posted @ 2016-08-06 14:56 Gu Feiyang 阅读(131) 评论(0) 推荐(0)
摘要:Given a string s, partition s such that every substring of the partition is a palindrome. Return the minimum cuts needed for a palindrome partitioning 阅读全文
posted @ 2016-07-12 15:10 Gu Feiyang 阅读(133) 评论(0) 推荐(0)
摘要:Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest l 阅读全文
posted @ 2016-07-12 14:20 Gu Feiyang 阅读(121) 评论(0) 推荐(0)
摘要:题目: Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the 阅读全文
posted @ 2016-04-24 14:55 Gu Feiyang 阅读(127) 评论(0) 推荐(0)
摘要:题意: Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n. For example:Given n = 13,Ret 阅读全文
posted @ 2016-04-12 22:07 Gu Feiyang 阅读(131) 评论(0) 推荐(0)
摘要:题意: Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the 阅读全文
posted @ 2016-04-12 21:28 Gu Feiyang 阅读(122) 评论(0) 推荐(0)
摘要:题目: There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the followin 阅读全文
posted @ 2016-04-02 23:37 Gu Feiyang 阅读(243) 评论(0) 推荐(0)
摘要:题意: Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure 阅读全文
posted @ 2016-03-31 23:12 Gu Feiyang 阅读(109) 评论(0) 推荐(0)
摘要:Given a collection of intervals, merge all overlapping intervals. For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18]. 思路: 按照每个线段 阅读全文
posted @ 2016-03-29 22:59 Gu Feiyang 阅读(116) 评论(0) 推荐(0)
摘要:327. Count of Range Sum 327. Count of Range Sum Given an integer array nums, return the number of range sums that lie in [lower, upper] inclusive.Rang 阅读全文
posted @ 2016-03-29 21:52 Gu Feiyang 阅读(226) 评论(0) 推荐(0)
摘要:题意: Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k 阅读全文
posted @ 2016-03-26 14:06 Gu Feiyang 阅读(147) 评论(0) 推荐(0)
摘要:题意: Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence of a string is a new string which is formed fr 阅读全文
posted @ 2016-03-22 22:56 Gu Feiyang 阅读(115) 评论(0) 推荐(0)
摘要:题意: 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 阅读全文
posted @ 2016-03-21 22:27 Gu Feiyang 阅读(139) 评论(0) 推荐(0)
摘要:题意: Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You are given a targe 阅读全文
posted @ 2016-03-21 21:28 Gu Feiyang 阅读(123) 评论(0) 推荐(0)
摘要:题意: Given an integer matrix, find the length of the longest increasing path. From each cell, you can either move to four directions: left, right, up o 阅读全文
posted @ 2016-03-20 15:14 Gu Feiyang 阅读(178) 评论(0) 推荐(0)
摘要:题意: Remove the minimum number of invalid parentheses in order to make the input string valid. Return all possible results. Note: The input string may 阅读全文
posted @ 2016-03-20 14:54 Gu Feiyang 阅读(178) 评论(0) 推荐(0)
摘要:题意: Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example,Given [100, 4, 200, 1, 3, 2],The lo 阅读全文
posted @ 2016-03-20 12:29 Gu Feiyang 阅读(119) 评论(0) 推荐(0)
摘要:题意: Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area. For example, given the following 阅读全文
posted @ 2016-03-19 19:54 Gu Feiyang 阅读(117) 评论(0) 推荐(0)