
leetcode
星落秋风五丈原
胜败乃兵家常事 少侠请重新来过
展开
-
leetcode-561. Array Partition I
Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), …, (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as possibl原创 2017-10-22 15:03:06 · 327 阅读 · 0 评论 -
leetcode-46. Permutations
题目Given a collection of distinct integers, return all possible permutations.Example: Input: [1,2,3] Output: [ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,...原创 2018-07-09 09:48:21 · 176 阅读 · 0 评论 -
leetcode-47. Permutations II
题目:Given a collection of numbers that might contain duplicates, return all possible unique permutations.Example: Input: [1,1,2] Output: [ [1,1,2], [1,2,1], [2,1,1] ]...原创 2018-07-08 21:56:12 · 219 阅读 · 0 评论 -
leetcode-287. Find the Duplicate Number
题目:Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate numbe...原创 2018-06-08 23:04:30 · 209 阅读 · 0 评论 -
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 ...原创 2018-03-22 00:20:29 · 124 阅读 · 0 评论 -
leetcode-15. 3Sum
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: The solution set must not contain dup...原创 2018-03-23 00:20:48 · 147 阅读 · 0 评论 -
leetcode-686. Repeated String Match
Given two strings A and B, find the minimum number of times A has to be repeated such that B is a substring of it. If no such solution, return -1.For example, with A = “abcd” and B = “cdabcdab”.Re原创 2018-01-08 19:52:02 · 226 阅读 · 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), desi原创 2017-10-22 15:13:48 · 260 阅读 · 0 评论 -
leetcode-448. Find All Numbers Disappeared in an Array
Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements of [1, n] inclusive that do not appear in this array.Could you原创 2017-10-25 22:41:27 · 179 阅读 · 0 评论 -
leetcode-3. Longest Substring Without Repeating Characters
题目:Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).Example: Input: S = “ADOBECODEBANC”, T = “ABC” Output: “BANC” ...原创 2018-07-07 19:09:30 · 145 阅读 · 0 评论