- 博客(21)
- 收藏
- 关注
原创 Leetcode 318. Maximum Product of Word Lengths
题目Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assume that each word will contain only lower
2018-01-07 21:14:11 107
原创 Leetcode 319.Bulb Switcher
题目There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every third bulb (turning on if it's off or turn
2018-01-06 23:04:17 152
原创 Leetcode 377. Combination Sum IV
题目Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target.Example:nums = [1, 2, 3]target = 4
2018-01-06 12:47:48 143
原创 Leetcode 368. Largest Divisible Subset
题目Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies: Si % Sj = 0 or Sj % Si = 0.If there are multiple
2018-01-06 12:36:24 179
原创 Leetcode 64. Minimum Path Sum
题目Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down or
2018-01-05 23:28:42 115
原创 Leetcode 502. IPO
题目Suppose LeetCode will start its IPO soon. In order to sell a good price of its shares to Venture Capital, LeetCode would like to work on some projects to increase its capital before the IPO. S
2018-01-05 23:22:16 201
原创 算法作业15.证明最大公共子图问题是NP问题
最大公共子图问题是给定两个图,要求去掉一些点后,两个图都得到一个节点数至少为b的子图,且两个子图完全相同。 首先假设最大公共子图存在且给出了子图的顶点是哪几个,那么可以在多项式时间内检验出这个解是否正确,所以最大公共子图问题是NP问题,接下来只需要证明它是NP难的,就可以证明它是NP完全问题。 我们已经知道求图的具有b个顶点的独立集的问题是一个NP完全问题,只要我们可以从求独立集的问题规约
2018-01-05 23:14:03 442
原创 547. Friend Circles
题目There 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 friend of C, the
2017-12-28 21:09:16 97
原创 740. Delete and Earn
题目Given 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 everyelement
2017-12-28 20:56:29 81
原创 Leetcode 221. Maximal Square
题目Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area.For example, given the following matrix:1 0 1 0 01 0 1 1 11 1 1 1 11
2017-12-15 14:44:59 116
原创 Week11 209. Minimum Size Subarray Sum
题目Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If there isn't one, return 0 instead.For example, g
2017-11-21 20:46:23 149
原创 Week10 53. Maximum Subarray
题目Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,1,-5,4],the contiguous subarray [4,-1
2017-11-12 20:54:32 134
原创 Week9 H-IN
题目Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index.According to the definition of h-index on Wi
2017-11-12 20:41:12 142
原创 Week8 Edit Distance
题目Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted on
2017-10-28 20:29:47 123
原创 Week7 187. Repeated DNA Sequences
题目All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes useful to identify repeated sequences within the DNA
2017-10-21 23:07:06 150
原创 Week6 513. Find Bottom Left Tree Value
题目Given a binary tree, find the leftmost value in the last row of the tree.Example 1:Input: 2 / \ 1 3Output:1Example 2: Input: 1 / \ 2
2017-10-12 23:37:18 150
原创 Week5 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 example to take course 0 you have to first take course 1, which is expre
2017-10-12 22:53:22 129
原创 Week4 134. Gas Station
题目There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station
2017-10-01 00:56:55 161
原创 Week3 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 to take course 0 you have to first take course 1, which is expre
2017-09-24 19:33:35 144
原创 Week2 215. Kth Largest Element in an Array
题目Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example,Given [3,2,1,5,6,4] and k = 2, re
2017-09-17 13:53:07 171
原创 Week1 121.Best Time to Buy and Sell Stock
题目Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the
2017-09-10 18:10:01 125
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人