随笔分类 - DFS
发表于 2019-05-31 22:30阅读:172评论:0推荐:0
摘要: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 su
阅读全文 »
发表于 2019-05-31 21:18阅读:24189评论:0推荐:0
摘要:Think about Zuma Game. You have a row of balls on the table, colored red(R), yellow(Y), blue(B), green(G), and white(W). You also have several balls i
阅读全文 »
发表于 2019-05-30 22:32阅读:252评论:0推荐:0
摘要:Remember the story of Little Match Girl? By now, you know exactly what matchsticks the little match girl has, please find out a way you can make one s
阅读全文 »
发表于 2019-03-14 20:53阅读:234评论:0推荐:0
摘要:Given two strings s1, s2, find the lowest ASCII sum of deleted characters to make two strings equal. Example 1: Example 2: Note: 0 < s1.length, s2.len
阅读全文 »
发表于 2019-03-14 18:46阅读:237评论:0推荐:0
摘要:Given 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
阅读全文 »
发表于 2019-03-10 21:30阅读:250评论:0推荐:0
摘要:In LeetCode Store, there are some kinds of items to sell. Each item has a price. However, there are some special offers, and a special offer consists
阅读全文 »
发表于 2019-02-28 09:55阅读:331评论:0推荐:0
摘要:In the "100 game," two players take turns adding, to a running total, any integer from 1..10. The player who first causes the running total to reach o
阅读全文 »
发表于 2019-02-16 20:51阅读:295评论:0推荐:0
摘要: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
阅读全文 »
发表于 2019-02-08 23:23阅读:353评论:0推荐:0
摘要:On a 2-dimensional grid, there are 4 types of squares: 1 represents the starting square. There is exactly one starting square. 2 represents the ending
阅读全文 »
发表于 2019-02-06 00:38阅读:198评论:0推荐:0
摘要:A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59). Each LED represents
阅读全文 »
发表于 2019-02-05 23:02阅读:179评论:0推荐:0
摘要:Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. Example: I
阅读全文 »
发表于 2018-12-23 18:57阅读:326评论:0推荐:0
摘要:Your car starts at position 0 and speed +1 on an infinite number line. (Your car can go into negative positions.) Your car drives automatically accord
阅读全文 »
发表于 2018-12-22 13:05阅读:302评论:0推荐:0
摘要:There are n cities connected by m flights. Each fight starts from city u and arrives at v with a price w. Now given all the cities and flights, togeth
阅读全文 »
发表于 2018-12-22 12:10阅读:310评论:0推荐:0
摘要:There 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
阅读全文 »
发表于 2018-12-15 22:21阅读:242评论:0推荐:0
摘要:Given an m x n matrix of non-negative integers representing the height of each unit cell in a continent, the "Pacific ocean" touches the left and top
阅读全文 »
发表于 2018-12-14 21:28阅读:188评论:0推荐:0
摘要:There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prerequisites, for example to take course 0 you have to
阅读全文 »
发表于 2018-12-13 21:33阅读:211评论:0推荐:0
摘要:There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prerequisites, for example to take course 0 you have to
阅读全文 »
发表于 2018-12-11 21:51阅读:161评论:0推荐:0
摘要:Given a binary tree, return all root-to-leaf paths. Note: A leaf is a node with no children. Example: Approach #1: C++. [recursive] Approach #2: Java.
阅读全文 »
发表于 2018-12-11 20:39阅读:217评论:0推荐:0
摘要:The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the root, each hou
阅读全文 »
发表于 2018-12-11 16:51阅读:236评论:0推荐:0
摘要:Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order. All of the tick
阅读全文 »