随笔分类 -  LeetCode

摘要:You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you nee 阅读全文
posted @ 2019-08-30 06:46 Review->Improve 阅读(181) 评论(0) 推荐(0)
摘要:mplement a SnapshotArray that supports the following interface: SnapshotArray(int length) initializes an array-like data structure with the given leng 阅读全文
posted @ 2019-08-07 12:06 Review->Improve 阅读(1275) 评论(0) 推荐(0)
摘要:There are N courses, labelled from 1 to N. We are given relations[i] = [X, Y], representing a prerequisite relationship between course X and course Y: 阅读全文
posted @ 2019-08-01 10:15 Review->Improve 阅读(3675) 评论(0) 推荐(0)
摘要:Given a non-decreasing array of positive integers nums and an integer K, find out if this array can be divided into one or more disjoint increasing su 阅读全文
posted @ 2019-07-15 22:11 Review->Improve 阅读(829) 评论(0) 推荐(0)
摘要:LeetCode 424. Longest Repeating Character Replacement Given a string that consists of only uppercase English letters, you can replace any letter in th 阅读全文
posted @ 2019-04-13 03:48 Review->Improve 阅读(415) 评论(0) 推荐(0)
摘要:Given a string which we can delete at most k, return whether you can make a palindrome. For example, given 'waterrfetawx' and a k of 2, you could dele 阅读全文
posted @ 2019-03-29 12:31 Review->Improve 阅读(294) 评论(0) 推荐(0)
摘要:There are N piles of stones arranged in a row. The i-th pile has stones[i] stones. A move consists of merging exactly K consecutive piles into one pil 阅读全文
posted @ 2019-03-04 07:49 Review->Improve 阅读(883) 评论(0) 推荐(0)
摘要:Given an array A of 0s and 1s, we may change up to K values from 0 to 1. Return the length of the longest (contiguous) subarray that contains only 1s. 阅读全文
posted @ 2019-03-04 00:33 Review->Improve 阅读(766) 评论(0) 推荐(0)
摘要:We are given that the string "abc" is valid. From any valid string V, we may split V into two pieces X and Y such that X + Y (X concatenated with Y) i 阅读全文
posted @ 2019-03-04 00:14 Review->Improve 阅读(724) 评论(0) 推荐(0)
摘要:Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. Example 1: Example 2: 阅读全文
posted @ 2019-03-02 13:20 Review->Improve 阅读(125) 评论(0) 推荐(0)
摘要:Given an array of integers A, find the sum of min(B), where B ranges over every (contiguous) subarray of A. Since the answer may be large, return the 阅读全文
posted @ 2019-03-02 00:51 Review->Improve 阅读(1228) 评论(0) 推荐(0)
摘要:On a N x N grid of cells, each cell (x, y) with 0 <= x < N and 0 <= y < N has a lamp. Initially, some number of lamps are on. lamps[i] tells us the lo 阅读全文
posted @ 2019-02-26 12:38 Review->Improve 阅读(626) 评论(0) 推荐(0)
摘要:In an array A containing only 0s and 1s, a K-bit flip consists of choosing a (contiguous) subarray of length K and simultaneously changing every 0 in 阅读全文
posted @ 2019-02-19 07:13 Review->Improve 阅读(1519) 评论(0) 推荐(0)
摘要:Consider all the leaves of a binary tree. From left to right order, the values of those leaves form a leaf value sequence. For example, in the given t 阅读全文
posted @ 2019-02-13 22:57 Review->Improve 阅读(186) 评论(0) 推荐(0)
摘要:For a non-negative integer X, the array-form of X is an array of its digits in left to right order. For example, if X = 1231, then the array form is [ 阅读全文
posted @ 2019-02-11 07:07 Review->Improve 阅读(843) 评论(0) 推荐(0)
摘要:Given a binary tree, return the vertical order traversal of its nodes values. For each node at position (X, Y), its left and right children respective 阅读全文
posted @ 2019-02-10 10:20 Review->Improve 阅读(901) 评论(0) 推荐(0)
摘要:Given two integers A and B, return any string S such that: S has length A + B and contains exactly A 'a' letters, and exactly B 'b' letters; The subst 阅读全文
posted @ 2019-02-10 02:08 Review->Improve 阅读(573) 评论(0) 推荐(0)
摘要:Given the root of a binary tree, each node has a value from 0 to 25 representing the letters 'a' to 'z': a value of 0 represents 'a', a value of 1 rep 阅读全文
posted @ 2019-02-05 12:48 Review->Improve 阅读(632) 评论(0) 推荐(0)
摘要:Given a binary tree, find the length of the longest path where each node in the path has the same value. This path may or may not pass through the roo 阅读全文
posted @ 2019-01-04 23:44 Review->Improve 阅读(415) 评论(0) 推荐(0)
摘要:This problem was recently asked by Google. Given a list of numbers and a number k, return whether any two numbers from the list add up to k. For examp 阅读全文
posted @ 2018-12-22 06:20 Review->Improve 阅读(320) 评论(0) 推荐(0)