- 博客(18)
- 收藏
- 关注
原创 576. Out of Boundary Paths
576. Out of Boundary PathsThere is an m by n grid with a ball. Given the start coordinate (i,j) of the ball, you can move the ball to adjacent cell or cross the grid boundary in four directions (up, do
2018-01-22 16:17:50 121
原创 Exercise 8.3
Exercise 8.3Problem: STINGY SAT is the following problem: given a set of clauses (each a disjunction of literals) and an integer k, find a satisfying assignment in which at most k variables are true,
2018-01-03 10:57:57 130
原创 399. Evaluate Division
399. Evaluate DivisionEquations are given in the format A / B = k, where A and B are variables represented as strings, and k is a real number (floating point number). Given some queries, return the ans
2018-01-02 16:25:07 138
原创 744. Network Delay Time
744. Network Delay TimeThere are N network nodes, labelled 1 to N.Given times, a list of travel times as directed edges times[i] = (u, v, w), where u is the source node, v is the target node, and w is
2018-01-02 16:21:18 169
原创 740. Delete and Earn
740. Delete and EarnGiven an array nums of integers, you can perform operations on the array.In each operation, you pick any nums[i] and delete it to earn nums[i] points. After, you must delete every e
2017-12-13 21:33:13 147
原创 698. Partition to K Equal Sum Subsets
698. Partition to K Equal Sum SubsetsGiven an array of integers nums and a positive integer k, find whether it’s possible to divide this array into k non-empty subsets whose sums are all equal. Exampl
2017-12-06 19:45:05 177
原创 712. Minimum ASCII Delete Sum for Two Strings
712. Minimum ASCII Delete Sum for Two StringsGiven two strings s1, s2, find the lowest ASCII sum of deleted characters to make two strings equal. Example 1:Input: s1 = "sea", s2 = "eat"Output: 231Ex
2017-11-29 21:47:18 158
原创 714. Best Time to Buy and Sell Stock with Transaction Fee
714. Best Time to Buy and Sell Stock with Transaction FeeYour are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative integer fee re
2017-11-29 19:37:03 141
原创 210. Course Schedule II
210. Course Schedule II在上一篇博客中,我们利用了入度来判断图中是否存在一个拓扑序列,而在本次博客中,我们将探讨如何找出拓扑序列。题目: There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for exampl
2017-11-16 13:54:58 142
原创 207. Course Schedule
207. Course Schedule接下来的三篇博客是有关于拓扑排序在题目中的应用,难度循序渐进,通过这三题来彻底把拓扑排序的方法牢牢掌握吧!题目: There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example t
2017-11-16 13:36:08 117
原创 718. Maximum Length of Repeated Subarray
718. Maximum Length of Repeated SubarrayGiven two integer arrays A and B, return the maximum length of an subarray that appears in both arrays. Example 1:Input:A: [1,2,3,2,1]B: [3,2,1,4,7]Output: 3
2017-11-02 08:44:26 606
原创 406. Queue Reconstruction by Height
406. Queue Reconstruction by HeightSuppose 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 the
2017-10-23 13:36:26 149
原创 659. Split Array into Consecutive Subsequences
659. Split Array into Consecutive SubsequencesYou are given an integer array sorted in ascending order (may contain duplicates), you need to split them into several subsequences, where each subsequence
2017-10-15 14:55:16 202
原创 547. Friend Circles
547. Friend CirclesThere are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature. For example, if A is a direct friend of B, and B is a direct
2017-10-02 09:51:31 164
原创 240. Search a 2D Matrix II
Add to List 240. Search a 2D Matrix IIWrite an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted in ascending f
2017-10-02 00:17:58 126
原创 215. Kth Largest Element in an Array
215. Kth Largest Element in an ArrayFind the k th largest element in an unsorted array. Note that it is the k th largest element in the sorted order, not the kth distinct element.For example, Given [3
2017-09-24 12:43:20 141
原创 241. Different Ways to Add Parentheses
241. Different Ways to Add ParenthesesGiven a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid opera
2017-09-17 17:05:52 175
原创 670. Maximum Swap
670. Maximum SwapQuestion:Given a non-negative integer, you could swap two digits at most once to get the maximum valued number. Return the maximum valued number you could get.Example 1: Input: 2736
2017-09-10 11:43:32 198
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人