自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(63)
  • 收藏
  • 关注

原创 63. leetCode3.Longest Substring Without Repeating Characters【最长不重复子串】

【题目】:Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answer is "b", with ...

2018-05-03 08:51:18 174

原创 62.leetCode131: Palindrome Partitioning【列表划分的回文判断】

【题目】:Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example, given s = "aab",Return[ ["aa","b"], ["a"...

2018-03-31 19:54:03 260

原创 61.leetCode140:Word Break II

【题目】:Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, add spaces in s to construct a sentence where each word is a valid dictionary word. You may assume the d...

2018-03-31 16:21:16 201

原创 60. leetCode37: Sudoku Solver

【题目】:Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character '.'.You may assume that there will be only one unique solution.A sudoku puzzle.........

2018-03-27 19:47:21 189

原创 59. leetCode36: Valid Sudoku

【题目】:Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character '.'.A partially filled sudoku ...

2018-03-27 16:21:11 156

原创 58. leetCode39: Combination Sum

【题目】:Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be chosen f...

2018-03-24 19:22:06 166

原创 57.leetCode51: N皇后

【题目】:The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions to the n-queens puzzle.Each...

2018-03-23 17:25:25 156

原创 56. leetCode78:Subsets

【题目】:Given a set of distinct integers, nums, return all possible subsets (the power set).Note: The solution set must not contain duplicate subsets.For example,If nums = [1,2,3], a solution is:[ [3],...

2018-03-22 07:50:17 221

原创 55. leetCode77. Combinations

【题目】:Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4],]【思...

2018-03-21 19:32:13 202

原创 54. leetCode 69: Sqrt(x)

【题目】:Implement int sqrt(int x).Compute and return the square root of x.x is guaranteed to be a non-negative integer.Example 1:Input: 4Output: 2Example 2:Input: 8Output: 2Explanation: The square ro...

2018-03-17 16:52:09 167

原创 53.leetCode67:Add Binary【两个二进制数相加】

【题目】:Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".【思路】:(1)把两个二进制数分别转成十进制数,随后进行相加得到一个十进制的和,把和转化成二进制 (2)从右向左对两个二进制数进行判断并相加,需要首先对较短的二进制左边填充0.若...

2018-03-17 16:11:14 243

原创 52. leetCode 49: Group Anagrams

【题目】:Given an array of strings, group anagrams together.For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return:[ ["ate", "eat","tea"], ["nat&

2018-03-13 15:42:21 151

原创 51. leetcode46:Permutations【数列全排列】

【题目】:Given a collection of distinct numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1]]【思...

2018-02-11 08:18:35 327

原创 50. leetCode27:Remove Element

【题目】:Given an array and a value, remove all instances of that value in-place and return the new length.Do not allocate extra space for another array, you must do this by modifying the input array in-p...

2018-02-10 07:06:03 220

原创 49. leetCode24: Swap Nodes in Pairs【两两交换列表元素】

【题目】:Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only cons...

2018-02-09 10:41:25 191

原创 48.leetCode 23:Merge k Sorted Lists【合并多个有序列表】

【题目】:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.【参考】:二分法和堆排序、Python版堆排序实现、【代码】:# Definition for singly-linked list.# class ListNode:# def _...

2018-02-08 18:00:29 172

原创 47. 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:[ "((()))", "(()())", "(())()", "()(())"...

2018-02-07 07:39:36 176

原创 46. leetCode 13: Roman to Integer【罗马数转化为数字】

【题目】:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.【参考】:参考资料【Python代码】:class Solution: def romanToInt(self, s):

2018-02-06 15:28:41 164

原创 45. leetCode12: Integer to Roman【数字转化为罗马字母】

【题目】:Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.【分析】:由上图总结规律可知,10+就是X后面连接1-9的个位数,20+就是XX后面连接1-9的个位数,... , 90+就是XC后面连接1-

2018-02-05 17:45:45 212

原创 44.leetCode 2: Add Two Numbers 【两数相加】

【题目】:You 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 two numbers

2018-02-04 17:17:45 196

原创 43. leetcode127: Word Ladder

【题目】:Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such that:Only one letter can be ch

2018-02-03 16:32:25 170

原创 42. leetCode125: Valid Palindrome【验证回文】

【题目】:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car

2018-02-02 19:29:01 149

原创 41. leetcode98. Validate Binary Search Tree【验证二叉搜索树】

【题目】:Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the no

2018-02-01 13:15:06 168

原创 40.leetCode88. Merge Sorted Array【合并有序数组】

【题目】:Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:You may assume that nums1 has enough space (size that is greater or equal to m + n) to

2018-01-31 14:18:30 138

原创 39. leetcode 73:Set Matrix Zeroes

【题目】:Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space?A straight forward solution

2018-01-31 12:42:27 125

原创 38.leetCode 70. Climbing Stairs

【题目】:You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note: Given n wil

2018-01-22 12:10:50 125

原创 37.leetCode 65. Valid Number

【题目】:验证输入的字符串能否正确地转换成合法的数字Validate if a given string is numeric.Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueNote: It is intended for the

2018-01-22 10:21:53 155

原创 36.leetCode 57:Insert Interval(插入区间)

【题目】:Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start

2018-01-20 07:07:23 248

原创 35. leetCode 56: Merge Intervals

【题目】:Given a collection of intervals, merge all overlapping intervals.For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18].【分析】:先对所有的给定区间,按区间的start从小到大进行排序,如下图所示:随后,遍历所有的区间,对需要合并的区

2018-01-19 11:33:45 133

原创 34. leetCode 28. Implement strStr()

【题目】:Implement strStr().Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Example 1:Input: haystack = "hello", needle = "ll"Output: 2Example 2:I

2018-01-18 13:27:04 109

原创 33. leetCode 21: Merge Two Sorted Lists

【题目】:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.Example:Input: 1->2->4, 1->3->4Output: 1->1->2->3->4-

2018-01-17 19:40:26 114

原创 32.leetCode 20. Valid Parentheses

【题目】:Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are

2018-01-16 09:06:25 118

原创 31.leetCode15: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 no

2018-01-15 17:12:50 121

原创 30.leetCode 8. String to Integer (atoi)

【题目描述】:Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the poss

2018-01-14 16:23:47 184

原创 29.leetcode1: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 us

2018-01-13 08:04:36 126

原创 安装scikit-learn

1.先下载numpy+mkl:http://www.lfd.uci.edu/~gohlke/pythonlibs/ 2.下载scipy:scipy-1.0.0-cp34-none-win_amd64.whl 3.下载matplotlib:matplotlib-2.1.0-cp34-none-win_amd64.whl 注意:1.要安装scikit-learn之前,要先装好以上三个package

2017-11-08 14:36:52 1063

原创 28.leetCode647:Palindromic Substrings

题目: Given a string, your task is to count how many palindromic substrings in this string. The substrings with different start indexes or end indexes are counted as different substrings even they con

2017-10-15 16:16:27 193

原创 27.leetCode637:Average of Levels in Binary Tree

题目:Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array. Example 1: Input: 3 / \ 9 20 / \ 15 7 Output: [3, 14.5, 11]

2017-10-12 08:38:46 246

原创 26.leetCode406:Queue Reconstruction by Height

题目: Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the person and k is the number of people in front of t

2017-10-11 10:25:55 164

原创 25.leetCode442:Find All Duplicates in an Array

题目: Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements that appear twice in this array. Could you do it without ex

2017-10-10 07:26:12 141

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除