自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Tc的专栏

道阻且长 行则将至

  • 博客(20)
  • 收藏
  • 关注

原创 LeetCode 92. Reverse Linked List II (链表 推荐)

Reverse a linked list from positionmton. Do it in one-pass.Note:1 ≤m≤n≤ length of list.Example:Input: 1->2->3->4->5->NULL, m = 2, n = 4Output: 1->4->3->2->5-...

2019-09-28 15:02:43 147

原创 LeetCode 915 Partition Array into Disjoint Intervals

Given an arrayA, partition itinto two (contiguous) subarraysleftandrightso that:Every element inleftis less than or equal to every element inright. leftandrightare non-empty. lefthas ...

2019-09-28 14:25:25 172

原创 LeetCode 1004 Max Consecutive Ones III (两点法 推荐)

Given an arrayAof 0s and 1s, we may change up toKvalues from 0 to 1.Return the length of the longest (contiguous) subarray that contains only 1s.Example 1:Input: A = [1,1,1,0,0,0,1,1,1,1,0...

2019-09-28 10:30:44 217

原创 LeetCode 565 Array Nesting (置换群个数)

A zero-indexed array A of length N contains all integers from 0 to N-1. Find and return the longest length of set S, where S[i] = {A[i], A[A[i]], A[A[A[i]]], ... } subjected to the rule below.Suppos...

2019-09-26 21:41:46 241

原创 LeetCode 926 Flip String to Monotone Increasing (dp)

A string of'0's and'1's ismonotone increasingif it consists of some number of'0's (possibly 0), followed by some number of'1's (also possibly 0.)We are given a stringSof'0's and'1's, and w...

2019-09-23 01:05:00 143

原创 HDU 5769 Substring (后缀数组)

SubstringTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2060Accepted Submission(s): 842Problem Description?? is practicing his pro...

2019-09-23 00:16:28 184

原创 LeetCode 713 Subarray Product Less Than K (两点法)

Your are given an array of positive integersnums.Count and print the number of (contiguous) subarrays where the product of all the elements in the subarray is less thank.Example 1:Input: nums...

2019-09-23 00:04:15 180

原创 LeetCode 846 Hand of Straights (模拟 O(n)解法)

Alice has ahandof cards, given as an array of integers.Now she wants to rearrange the cards into groups so that each group is sizeW, and consists ofWconsecutive cards.Returntrueif and only i...

2019-09-22 08:47:49 305

原创 LeetCode 57 Insert Interval (二分 + 模拟 推荐)

Given a set ofnon-overlappingintervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times.Examp...

2019-09-22 01:00:37 219

原创 LeetCode 673 Number of Longest Increasing Subsequence (dp LIS个数 推荐)

Given an unsorted array of integers, find the number of longest increasing subsequence.Example 1:Input: [1,3,5,4,7]Output: 2Explanation: The two longest increasing subsequence are [1, 3, 4, 7] ...

2019-09-21 23:13:57 160

原创 LeetCode 662 Maximum Width of Binary Tree (BFS 推荐)

Given a binary tree, write a function to get the maximum width of the given tree. The width of a tree is the maximum width among all levels. The binary tree has the same structure as afull binary tre...

2019-09-21 20:33:30 190

原创 LeetCode 540 Single Element in a Sorted Array (二分 推荐)

You are given a sorted array consisting of only integers where every element appears exactly twice, except for one element which appears exactlyonce. Find this single element that appears only once....

2019-09-20 01:25:51 177

原创 LeetCode 611 Valid Triangle Number (二分 或 两点法 推荐)

Given an array consists of non-negative integers, your task is to count the number of triplets chosen from the array that can make triangles if we take them as side lengths of a triangle.Example 1:...

2019-09-19 22:29:39 123

原创 LeetCode 1028 Recover a Tree From Preorder Traversal (栈 或 DFS 推荐)

We run apreorderdepth first search on therootof a binary tree.At each node in this traversal, we outputDdashes (whereDis thedepthof this node), then we output the value of this node.(If ...

2019-09-19 21:38:16 231

原创 LeetCode 547 Friend Circles (并查集)

There areNstudents in a class. Some of them are friends, while some are not. Their friendship is transitive in nature. For example, if A is adirectfriend of B, and B is adirectfriend of C, then ...

2019-09-18 12:31:28 224

原创 LeetCode 1110 Delete Nodes And Return Forest (DFS 推荐)

Given therootof a binary tree, each node in the tree has a distinct value.After deletingall nodes with a value into_delete, we are left with a forest (adisjoint union of trees).Return the roo...

2019-09-17 21:51:11 196

原创 LeetCode 743 Network Delay Time (SPFA 或 Dijkstra)

There areNnetwork nodes, labelled1toN.Giventimes, a list of travel times asdirectededgestimes[i] = (u, v, w), whereuis the source node,vis the target node, andwis the time it takes for...

2019-09-16 14:24:42 296

原创 LeetCode 947 Most Stones Removed with Same Row or Column (并查集)

On a 2D plane, we place stones at some integer coordinate points. Each coordinate point may have at most one stone.Now, amoveconsists of removing a stonethat shares a column or row with another ...

2019-09-16 13:39:31 262

原创 LeetCode 129 Sum Root to Leaf Numbers (DFS)

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 tota...

2019-09-01 19:42:29 171

原创 LeetCode 1155 Number of Dice Rolls With Target Sum (dp 分组背包)

You haveddice, and each die hasffaces numbered1, 2, ..., f.Return the number of possible ways (out offdtotal ways)modulo10^9 + 7to roll the dice so the sum of the face up numbers equalsta...

2019-09-01 19:27:04 570

空空如也

空空如也

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

TA关注的人

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