自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 45. Jump Game II

Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Your goal ...

2019-09-25 11:24:00 120

转载 69. Sqrt(x)

Implementint sqrt(int x).Compute and return the square root ofx, wherexis guaranteed to be a non-negative integer.Since the return typeis an integer, the decimal digits are truncated and...

2019-09-25 02:17:00 122

转载 216. Combination Sum III

Find all possible combinations ofknumbers that add up to a numbern, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers.Note:All number...

2019-09-23 04:03:00 101

转载 93. Restore IP Addresses

Given a string containing only digits, restore it by returning all possible valid IP address combinations.Example:Input: "25525511135"Output: ["255.255.11.135", "255.255.111.35"]class S...

2019-09-20 23:43:00 100

转载 52. N-Queens II

Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return the number ofdistinct solutions to then-quee...

2019-09-20 10:10:00 83

转载 63. Unique Paths II

A robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach t...

2019-09-20 02:22:00 97

转载 62. Unique Paths

A robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach t...

2019-09-20 01:32:00 80

转载 130. Surrounded Regions

Given a 2D board containing'X'and'O'(the letter O), capture all regions surrounded by'X'.A region is captured by flipping all'O's into'X's in that surrounded region.Example:X X X X...

2019-09-19 13:22:00 86

转载 306. Additive Number

Additive number is a string whose digits can form additive sequence.A valid additive sequence should containat leastthree numbers. Except for the first two numbers, each subsequent number in ...

2019-09-19 13:13:00 82

转载 127. Word Ladder

Given two words (beginWordandendWord), and a dictionary's word list, find the length of shortest transformation sequence frombeginWordtoendWord, such that:Only one letter can be changed ...

2019-09-19 02:01:00 93

转载 17. Letter Combinations of a Phone Number

17. Letter Combinations of a Phone NumberGiven a string containing digits from2-9inclusive, return all possible letter combinations that the number could represent.A mapping of digit to l...

2019-09-18 03:07:00 80

转载 77. Combinations

Given two integersnandk, return all possible combinations ofknumbers out of 1 ...n.Example:Input:n = 4, k = 2Output:[ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4],]...

2019-09-18 02:33:00 86

转载 90. Subsets II

Given a collection of integers that might contain duplicates,nums, return all possible subsets (the power set).Note:The solution set must not contain duplicate subsets.Example:Input: [1,2...

2019-09-17 13:13:00 67

转载 78. Subsets

Given a set ofdistinctintegers,nums, return all possible subsets (the power set).Note:The solution set must not contain duplicate subsets.Example:Input: nums = [1,2,3]Output:[ [3...

2019-09-16 23:20:00 95

转载 275. H-Index II

Given an array of citationssortedin ascending order(each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index.According to thedefinition...

2019-09-15 11:14:00 81

转载 154. Find Minimum in Rotated Sorted Array II

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]).Find the minimum element.The array may c...

2019-09-13 09:18:00 72

转载 153. Find Minimum 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]).Find the minimum element.You may assume ...

2019-09-13 09:16:00 78

转载 240. Search a 2D Matrix II

Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted in ascending from left to right.Integers ...

2019-09-12 13:17:00 71

转载 74. Search a 2D Matrix

Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first integer of e...

2019-09-12 12:29:00 81

转载 81. Search in Rotated Sorted Array II

Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e.,[0,0,1,2,2,5,6]might become[2,5,6,0,0,1,2]).You are given a target value to search. If f...

2019-09-12 11:30:00 85

转载 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 arr...

2019-09-11 11:44:00 51

转载 164. Maximum Gap

Given an unsorted array, find the maximum difference between the successive elements in its sorted form.Return 0 if the array contains less than 2 elements.Example 1:Input: [3,6,9,1]Outpu...

2019-09-11 03:03:00 66

转载 274. H-Index

Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index.According to thedefinition of h-index on Wikipedia: ...

2019-09-10 13:01:00 64

转载 215. Kth Largest Element in an Array

Find thekth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.Example 1:Input: [3,2,1,5,6,4] and k = 2Output: ...

2019-09-10 01:50:00 55

转载 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->4Outpu...

2019-09-06 08:12:00 63

转载 147. Insertion Sort List

Sort a linked list using insertion sort.A graphical example of insertion sort. The partial sorted list (black) initially contains only the first element in the list.With each iterati...

2019-09-06 02:15:00 65

转载 236. Lowest Common Ancestor of a Binary Tree

Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to thedefinition of LCA on Wikipedia: “The lowest common ancestor is defined between two nod...

2019-09-05 10:53:00 58

转载 129. Sum Root to Leaf Numbers

Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3which represents the number123.Find the...

2019-09-05 09:45:00 65

转载 117. Populating Next Right Pointers in Each Node II

Given a binary treestruct Node { int val; Node *left; Node *right; Node *next;}Populate each next pointer to point to its next right node. If there is no next right node, the ...

2019-09-05 01:53:00 54

转载 124. Binary Tree Maximum Path Sum

Given anon-emptybinary tree, find the maximum path sum.For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child conn...

2019-09-05 01:18:00 46

转载 113. Path Sum II

Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.Note:A leaf is a node with no children.Example:Given the below binary tree andsum = 2...

2019-09-04 09:21:00 53

转载 112. Path Sum

Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Note:A leaf is a node with no children.Exa...

2019-09-04 06:44:00 47

转载 230. Kth Smallest Element in a BST

Given a binary search tree, write a functionkthSmallestto find thekth smallest element in it.Note:You may assume k is always valid, 1 ≤ k ≤ BST's total elements.Example 1:Input: root = ...

2019-09-03 11:03:00 53

转载 235. Lowest Common Ancestor of a Binary Search Tree

Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to thedefinition of LCA on Wikipedia: “The lowest common ancestor is defined bet...

2019-09-02 04:55:00 105

转载 109. Convert Sorted List to Binary Search Tree

Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.For this problem, a height-balanced binary tree is defined as a binary tree in which...

2019-09-02 04:08:00 72

转载 106. Construct Binary Tree from Inorder and Postorder Traversal

Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.For example, giveninorder =[9,3,15,20,7]postorder ...

2019-09-01 03:25:00 58

转载 114. Flatten Binary Tree to Linked List

Given a binary tree, flatten it to a linked list in-place.For example, given the following tree: 1 / \ 2 5 / \ \3 4 6The flattened tree should look like:1 \ 2...

2019-08-30 11:37:00 52

转载 110. Balanced Binary Tree

Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.Note:A leaf is a node with no ch...

2019-08-30 01:56:00 50

转载 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.Exa...

2019-08-30 00:39:00 55

转载 173. Binary Search Tree Iterator

Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Callingnext()will return the next smallest number in the BST.Example:...

2019-08-29 01:40:00 53

空空如也

空空如也

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

TA关注的人

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