自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 leetcode: 77 Combinations

Combinations组合Given two integers n and k, return all possible combinations of k numbers out of 1 … n.You may return the answer in any order.给定两个整数n和k,返回1,…,n中所有可能的k个数的组合。backtracking 的方法递归class Solution: def combine(self, n: int, k: int) ->

2021-02-10 11:10:34 85 1

原创 leetcode 57: Insert Interval

Insert IntervalGiven 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 times.给出一个无重叠的,按照区间起始端点排序的区间列表。在列表中插入一个新的区间,你需要确保列表中

2021-02-09 11:10:51 134

原创 56 Merge Intervals

Merge intervals合并区间Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the input.合并所有的overlapping intervals, 并且返回一个array来

2021-02-08 12:37:28 126

原创 leetcode 46: Maximum subarray

Maximum subarray最大子序和Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.Follow up: If you have figured out the O(n) solution, try coding another solution using the div

2021-02-05 14:44:02 61

原创 leetcode 46: Permutations

Permutations全排列Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order.class Solution: def permute(self, nums: List[int]) -> List[List[int]]: if len(nums)==1: re

2021-02-04 14:52:57 63

原创 leetcode 49. Group Anagrams

Group Anagrams字母异位词分组Given an array of strings strs, group the anagrams together. You can return the answer in any order.An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original let

2021-02-03 13:42:03 144

原创 leetcode 35. search insert position

search insert positionGiven a sorted array of distinct integers 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.如果找到这个value,则返回index,如果没有找到,返回按照顺序被插入的index.常规法第一种 一个麻

2021-02-02 14:32:23 105

原创 leetcode 27. Remove element

Remove elementGiven an array nums and a value val, 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-place with O(1) extra memory.The ord

2021-02-01 11:03:52 78

原创 leetcode 24. Swap nodes in Pairs

Swap nodes in pairsGiven a linked list, swap every two adjacent nodes and return its head.给定一个链表,交换链表中相邻的结点,并返回其头部。也就是返回交换后的链表不能只是单纯的改变节点内部的值,而是要实际的进行节点交换。...

2021-01-31 11:04:49 105 1

原创 leetcode 22 Generate Parentheses

生成括号Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.采用回溯法(1)有许多问题,当要找出它的解集或者要求回答什么解是满足某些约束条件的最佳解时,往往要用回溯法。(2)基本做法是:搜索,或是一种组织的井井有条的,能避免不必要搜索的穷举式搜索法。这种方法适合于解一些组合数相当大的问题。(3)回溯法在问题的解空间树中,按深度优先策略,从根结点

2021-01-30 12:42:36 72

原创 leetcode 21.Merge two sorted lists

Merge two sorted listedMerge two sorted linked lists and return is as a sorted list. The list should be made by splicing together the nodes of the first two lists.![在这里插入图片描述](https://img-blog.csdnimg.cn/20210129104204671.png width=“30”?x-oss-process=ima

2021-01-29 10:44:49 143

原创 leetcode 20. Valid Parentheses

有效的括号valid parentheses题目:Given a string s containing just the characters ‘(’, ‘)’, ‘{’, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.An input string is valid if:Open brackets must be closed by the same type of brackets. (相同类型)Open bracket

2021-01-28 16:11:11 65

原创 leecode 1. TwoSum

第1题—两数之和

2021-01-27 17:06:33 72

原创 leetcode 2. Add two numbers

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 contains a single digit. Add the two numbers and return the sum as a linked list.You may a

2021-01-27 17:05:44 47

空空如也

空空如也

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

TA关注的人

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