- 博客(24)
- 收藏
- 关注
原创 LeetCode第40题—— Combination Sum II
问题描述Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target.Each number in candidates...
2019-04-12 11:49:14 160
原创 LeetCode第39题——combanation sum
问题描述Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target.The same re...
2019-04-12 11:07:43 231
原创 LeetCode第36题——valid sudoku
问题描述Determine if a 9x9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules:Each row must contain the digits 1-9 without repetition.Each column must co...
2019-04-12 10:19:43 159
原创 LeetCode第34题—— Find First and Last Position of Element in Sorted Array O(logn)解法
问题描述Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value.Your algorithm’s runtime complexity must be in the order of O(log n).If ...
2019-04-11 21:29:57 129
原创 LeetCode第33题——search in rotated array的O(logn)解法
问题描述Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).You are given a target value to search. If fou...
2019-04-11 11:29:58 320
原创 leetcode第31题——next permutation(超过100%的解法)
问题描述Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it as the lowest possib...
2019-04-10 22:49:51 250
原创 LeetCode第29题——Divide Two Integer
问题描述Given two integers dividend and divisor, divide two integers without using multiplication, division and mod operator.Return the quotient after dividing dividend by divisor.The integer division ...
2019-04-09 21:12:50 172
原创 leetcode第24题——swap nodes in pairs 高效解法
问题描述Given a linked list, swap every two adjacent nodes and return its head.You may not modify the values in the list’s nodes, only nodes itself may be changed.Example:Given 1->2->3->4, yo...
2019-04-09 20:48:15 251
原创 LeetCode第22题——Generate Parentheses
问题描述Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[“((()))”,“(()())”,“(())()”,“()(())”,“()(...
2019-04-09 20:31:24 208
原创 leetcode第19题——remove nth node from end of list
问题描述Given a linked list, remove the n-th node from the end of list and return its head.Example:Given linked list: 1->2->3->4->5, and n = 2.After removing the second node from the end, ...
2019-04-03 17:03:15 170
原创 leetcode第18题——4Sum
问题描述Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum o...
2019-04-03 16:58:41 174
原创 leetcode第17题——letter combination of a phone number
问题描述Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is...
2019-04-03 12:00:11 201
原创 leetcode第16题——2Sum Cloest
问题描述Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input w...
2019-04-02 22:58:27 178
原创 LeetCode15题——3sum
问题描述Given an array nums of n integers, are there elements a, b, c in nums 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 c...
2019-04-02 22:17:50 105
原创 LeetCode12题——integer to roman
问题描述oman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X 10L 50C 100D ...
2019-02-25 17:11:25 237
原创 LeetCode11题——container with most water
问题描述Given n non-negative integers a1, a2, …, an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find ...
2019-02-25 16:33:19 278
原创 LeetCode第八题——string to integer
问题描述Implement atoi which converts a string to an integer.The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from...
2019-02-22 20:21:39 324
原创 LeetCode第七题——converse integer
问题描述Given a 32-bit signed integer, reverse digits of an integer.Example 1:Input: 123Output: 321Example 2:Input: -123Output: -321Example 3:Input: 120Output: 21Note:Assume we are dealing wit...
2019-02-22 16:18:28 172
原创 LeetCode第六题——zigzag conversion
问题描述The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S ...
2019-02-22 15:55:37 143
原创 leetcode第五题——最长回文子串
问题描述Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example 1:Input: “babad”Output: “bab”Note: “aba” is also a valid answer.Exa...
2019-02-22 15:06:25 201
原创 LeetCoded第四题——median of two sorted array解法
问题描述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)).You may assume nums1 an...
2019-02-21 19:10:56 362
原创 LeetCode第三题:Longest Substring Without Repeating Characters
leetcode第三题解法问题描述Given a string, find the length of the longest substring without repeating characters.Example 1:Input: “abcabcbb”Output: 3Explanation: The answer is “abc”, with the length of 3....
2019-02-20 17:16:16 88
原创 leetcode第二题解法
leetcode第二题Add Two NumYou are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the ...
2019-02-19 22:48:18 174
原创 LeetCode第一题Two Sum的O(n)解法
leetcode刷题记录第一题 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, a...
2019-01-18 14:32:59 355
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人