leetcode
bowen_wu_
这个作者很懒,什么都没留下…
展开
-
LeetCode题解系列--1. Two Sum
描述Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the same e原创 2017-09-09 14:14:58 · 256 阅读 · 0 评论 -
LeetCode题解系列--763. Partition Labels
描述A string S of lowercase letters is given. We want to partition this string into as many parts as possible so that each letter appears in at most one part, and return a list of integers representin原创 2018-01-18 12:24:31 · 637 阅读 · 0 评论 -
LeetCode题解系列--309. Best Time to Buy and Sell Stock with Cooldown
描述Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy原创 2018-01-18 01:00:16 · 384 阅读 · 0 评论 -
LeetCode题解系列--188. Best Time to Buy and Sell Stock IV
描述Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most k transactions.Note: You may no原创 2018-01-17 16:53:55 · 333 阅读 · 0 评论 -
LeetCode题解系列--123. Best Time to Buy and Sell Stock III
描述Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most two transactions.Note: You may原创 2018-01-17 13:33:24 · 192 阅读 · 0 评论 -
LeetCode题解系列--122. Best Time to Buy and Sell Stock II
描述Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy原创 2018-01-17 11:54:15 · 190 阅读 · 0 评论 -
LeetCode题解系列--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 stock原创 2018-01-17 11:48:11 · 185 阅读 · 0 评论 -
LeetCode题解系列--714. Best Time to Buy and Sell Stock with Transaction Fee
描述Your 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 representing a transaction fee.You may complete as many t原创 2017-12-13 16:39:53 · 944 阅读 · 0 评论 -
LeetCode题解系列--712. Minimum ASCII Delete Sum for Two Strings
描述Given 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: 231 Explanation: Deleting “s” from “sea” adds t原创 2017-11-02 19:52:01 · 697 阅读 · 0 评论 -
LeetCode题解系列--718. Maximum Length of Repeated Subarray
描述Given 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 Explanation: The repeated subar原创 2017-11-01 21:29:40 · 2010 阅读 · 0 评论 -
LeetCode题解系列--684. Redundant Connection
描述In this problem, a tree is an undirected graph that is connected and has no cycles.The given input is a graph that started as a tree with N nodes (with distinct values 1, 2, …, N), with one additiona原创 2017-10-10 14:36:22 · 278 阅读 · 0 评论 -
LeetCode题解系列--685. Redundant Connection II
描述In this problem, a rooted tree is a directed graph such that, there is exactly one node (the root) for which all other nodes are descendants of this node, plus every node has exactly one parent, exce原创 2017-10-18 14:38:06 · 1686 阅读 · 0 评论 -
LeetCode题解系列--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, return 5.Note原创 2017-09-18 10:30:22 · 399 阅读 · 0 评论 -
LeetCode题解系列--4. Median of Two Sorted Arrays
描述: There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).原创 2017-09-06 20:14:04 · 368 阅读 · 0 评论 -
LeetCode题解系列--5. Longest Palindromic Substring
描述Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example:Input: “babad”Output: “bab”Note: “aba” is also a valid answer. Example:Inpu原创 2017-09-09 14:29:49 · 221 阅读 · 0 评论 -
习题8.15
题目Show that the following problem is NP-complete. MAXIMUM COMMON SUBGRAPH Input: Two graphs G1 = (V1, E1) and G2 = (V2, E2); a budget b. Output: Two set of nodes V1′ ⊆ V1 and V2′ ⊆ V2 whose delet翻译 2018-01-18 12:41:13 · 318 阅读 · 0 评论