随笔分类 - 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
阅读全文
摘要:题意: Implement a basic calculator to evaluate a simple expression string. The expression string contains only non-negative integers, +, -, *, / operato
阅读全文
摘要:题意: 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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要:题目: 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
阅读全文
摘要:题意: 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
阅读全文
摘要:题意: 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
阅读全文
摘要:题目: 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
阅读全文
摘要:题意: Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure
阅读全文
摘要: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]. 思路: 按照每个线段
阅读全文
摘要: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
阅读全文
摘要:题意: 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
阅读全文
摘要:题意: 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
阅读全文
摘要:题意: 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
阅读全文
摘要:题意: 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
阅读全文
摘要:题意: 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
阅读全文
摘要:题意: Remove the minimum number of invalid parentheses in order to make the input string valid. Return all possible results. Note: The input string may
阅读全文
摘要:题意: 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
阅读全文
摘要:题意: 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
阅读全文

浙公网安备 33010602011771号