- 博客(29)
- 收藏
- 关注
原创 【python list】关于Python list的append 和extend方法的使用
list1=[1, 2, 3] .list2=[4, 5, 6] list1.append(list2) 的结果为[1, 2, 3, [4, 5, 6]] list1.extend(list2) 的结果为[1, 2, 3, 4, 5, 6]
2019-04-30 15:47:36 951
原创 【leetcode每日刷题】40. Combination Sum II
Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations incandidateswhere the candidate numbers sums totarget.Each number incandidatesmay...
2019-04-30 10:32:18 175
原创 【leetcode每日刷题】39. Combination Sum
Given asetof candidate numbers (candidates)(without duplicates)and a target number (target), find all unique combinations incandidateswhere the candidate numbers sums totarget.Thesamerepeat...
2019-04-30 10:12:58 150
原创 【leetcode每日刷题】89. Gray Code
The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the total number of bits in the code, print the sequence of gr...
2019-04-29 10:21:17 152
原创 【leetcode每日刷题】【DP】72. Edit Distance
Given two wordsword1andword2, find the minimum number of operations required to convertword1toword2.You have the following 3 operations permitted on a word:Insert a character Delete a chara...
2019-04-24 10:18:43 182
原创 【leetcode每日刷题】100. Same Tree
Given two binary trees, write a function to check if they are the same or not.Two binary trees are considered the same if they are structurally identical and the nodes have the same value.Example ...
2019-04-21 13:58:20 107
原创 【leetcode每日刷题】79. Word Search
Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically n...
2019-04-21 12:20:26 213
原创 【leetcode每日刷题】16. 3Sum Closest
Given an arraynumsofnintegers and an integertarget, find three integers innumssuch that the sum is closest totarget. Return the sum of the three integers. You may assume that each input would ...
2019-04-17 16:14:38 138
原创 【leetcode每日刷题】【linkedlist】24. Swap Nodes in Pairs
Given alinked list, swap every two adjacent nodes and return its head.You maynotmodify the values in the list's nodes, only nodes itself may be changed.Example:Given 1->2->3->4, ...
2019-04-17 09:59:01 230
原创 【leetcode每日刷题】36. Valid Sudoku
Determine if a9x9 Sudoku boardis valid.Only the filled cells need to be validatedaccording to the following rules:Each rowmust contain thedigits1-9without repetition. Each column must conta...
2019-04-17 09:46:19 138
原创 【leetcode每日刷题】35. Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array....
2019-04-16 15:12:43 204
原创 【leetcode每日刷题】34. Find First and Last Position of Element in Sorted Array
Given an array of integersnumssorted in ascending order, find the starting and ending position of a giventargetvalue.Your algorithm's runtime complexity must be in the order ofO(logn).If the...
2019-04-16 15:06:22 120
原创 【leetcode每日刷题】33. Search in Rotated Sorted Array
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 found ...
2019-04-16 14:46:43 127
原创 【leetcode每日刷题】29. Divide Two Integers
Given two integersdividendanddivisor, divide two integers without using multiplication, division and mod operator.Return the quotient after dividingdividendbydivisor.The integer division sho...
2019-04-16 11:47:02 164
原创 【leetcode每日刷题】27. Remove Element
Given an arraynumsand a valueval, remove all instances of that valuein-placeand return the new length.Do not allocate extra space for another array, you must do this bymodifying the input arra...
2019-04-16 11:00:12 118
原创 【leetcode每日刷题】Remove Duplicates from Sorted Array
Given a sorted arraynums, remove the duplicatesin-placesuch that each element appear onlyonceand return the new length.Do not allocate extra space for another array, you must do this bymodifyi...
2019-04-16 10:50:20 176
原创 【leetcode每日刷题】32. Longest Valid Parentheses
Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.Example 1:Input: "(()"Output: 2Explanation: The longest valid...
2019-04-15 10:23:28 131
原创 【leetcode每日刷题】22. Generate Parentheses
Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:[ "((()))", "(()())", "(())()", "()(())"...
2019-04-13 11:51:25 100
原创 【leetcode每日刷题】【hard】10. Regular Expression Matching
Given an input string (s) and a pattern (p), implement regular expression matching with support for'.'and'*'.'.' Matches any single character.'*' Matches zero or more of the preceding element....
2019-04-11 11:01:52 174
原创 【leetcode每日刷题】23. Merge k Sorted Lists
Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.Example:Input:[ 1->4->5, 1->3->4, 2->6]Output: 1->1->2->3->4-...
2019-04-10 10:04:52 89
原创 【leetcode每日刷题】86. Partition List
Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the original relative order of the nodes in each of t...
2019-04-09 03:15:24 144
原创 【leetcode每日刷题】98. 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 keysless thanthe node's key. The ...
2019-04-08 14:59:56 130
原创 【leetcode每日刷题】49. Group Anagrams
Given an array of strings, group anagrams together.Example:Input: ["eat", "tea", "tan", "ate", "nat", "bat"],Output:[ ["ate","eat","tea"], ["nat","tan"], ["bat"]]Note:All inputs will...
2019-04-07 08:25:39 616
原创 【leetcode每日刷题】15. 3Sum
Given an arraynumsofnintegers, are there elementsa,b,cinnumssuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:The solution set must not cont...
2019-04-05 14:05:25 208
原创 【leetcode每日刷题】3. Longest Substring Without Repeating Characters
Given a string, find the length of thelongest substringwithout repeating characters.Example 1:Input: "abcabcbb"Output: 3 Explanation: The answer is "abc", with the length of 3. Example 2:...
2019-04-03 21:27:16 90
原创 【leetcode每日刷题】5. Longest Palindromic Substring
Given a strings, find the longest palindromic substring ins. You may assume that the maximum length ofsis 1000.Example 1:Input: "babad"Output: "bab"Note: "aba" is also a valid answer.Exa...
2019-04-03 21:02:15 96
原创 【leetcode每日刷题】17. Letter Combinations of a Phone Number
Given a string containing digits from2-9inclusive, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is giv...
2019-04-02 15:44:03 145
原创 【leetcoed每日刷题】13. Roman to Integer
Roman numerals are represented by seven different symbols:I,V,X,L,C,DandM.Symbol ValueI 1V 5X 10L 50C 100D ...
2019-04-01 12:36:50 127
原创 【leetcode每日刷题】12. Integer to Roman
Roman numerals are represented by seven different symbols:I,V,X,L,C,DandM.Symbol ValueI 1V 5X 10L 50C 100D ...
2019-04-01 12:03:48 129
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人