自定义博客皮肤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的专栏

待重头,收拾旧山河,朝天阙

原创 Android Open Source Project Patches

注: 以下链接均要翻墙 1.Optimize code on get UidDetail in AppDataUsage 链接:https://android-review.googlesource.com/#/c/platform/packages/apps/Settings/+/348...

2017-10-29 15:02:01 1061 0

原创 LeetCode 1372 Longest ZigZag Path in a Binary Tree (DFS)

Given a binary treeroot, aZigZag path for a binary tree is defined as follow: Chooseanynode in the binary tree and a direction (right or left). If ...

2020-04-25 23:55:34 59 0

原创 LeetCode 1325 Delete Leaves With a Given Value (DFS)

Given a binary treerootand an integertarget, delete all theleaf nodeswith valuetarget. Notethat once you delete a leaf node with valuetarget,if it&#...

2020-04-16 14:24:04 53 0

原创 Codeforce 1151D Stas and the Queue at the Buffet (公式推导 排序)

D. Stas and the Queue at the Buffet time limit per test:1 second memory limit per test:256 megabytes During a break in the buffet of the scientific...

2020-04-12 17:31:55 49 0

原创 LeetCode 701 Insert into a Binary Search Tree (DFS)

Given the root node of a binary search tree (BST) and a value to be inserted into the tree,insert the value into the BST. Return the root node of the...

2020-02-17 23:27:09 77 0

原创 LeetCode 958 Check Completeness of a Binary Tree (BFS)

Given a binary tree, determine if it is acomplete binary tree. Definition of a complete binary tree fromWikipedia: In a complete binary tree every l...

2020-02-17 22:39:08 50 0

原创 LeetCode 203 Remove Linked List Elements (链表)

Remove all elements from a linked list of integers that have valueval. Example: Input: 1->2->6->3->4->5->6, val = 6 Output: 1-&...

2019-12-24 03:19:58 82 0

原创 LeetCode 974 Subarray Sums Divisible by K (hash)

Given an arrayAof integers, return the number of (contiguous, non-empty) subarrays that have a sum divisible byK. Example 1: Input: A = [4,5,0,-...

2019-12-24 03:10:34 43 0

原创 Codeforces 102394I Interesting Permutation (脑洞)

I. Interesting Permutation time limit per test 1 second memory limit per test 512 megabytes DreamGrid has an interesting permutation of 1,2,…,n den...

2019-11-09 17:49:30 147 0

原创 LeetCode 934 Shortest Bridge (DFS + BFS 推荐)

In a given 2D binary arrayA, there are two islands. (An island is a 4-directionally connected group of1s not connected to any other 1s.) Now, we may...

2019-10-13 13:19:01 127 0

原创 LeetCode 310 Minimum Height Trees (DFS 树的直径 推荐)

For an undirected graph with tree characteristics, we can choose any node as the root. The result graph is then a rooted tree. Among all possible roo...

2019-10-07 21:13:02 146 0

原创 LeetCode 695 Max Area of Island (DFS)

Given a non-empty 2D arraygridof 0's and 1's, anislandis a group of1's (representing land) connected 4-directionally (horizontal or ve...

2019-10-07 18:18:47 64 0

原创 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 = ...

2019-09-28 15:02:43 34 0

原创 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....

2019-09-28 14:25:25 33 0

原创 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. ...

2019-09-28 10:30:44 53 0

原创 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...

2019-09-26 21:41:46 46 0

原创 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...

2019-09-23 01:05:00 40 0

原创 HDU 5769 Substring (后缀数组)

Substring Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 2060Accepted Submission(s): 842 Pro...

2019-09-23 00:16:28 47 0

原创 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 ...

2019-09-23 00:04:15 32 0

原创 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 o...

2019-09-22 08:47:49 43 0

原创 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 initia...

2019-09-22 01:00:37 54 0

原创 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: 2 Explanation: The t...

2019-09-21 23:13:57 38 0

原创 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 bina...

2019-09-21 20:33:30 59 0

原创 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....

2019-09-20 01:25:51 37 0

原创 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 ta...

2019-09-19 22:29:39 28 0

原创 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), the...

2019-09-19 21:38:16 46 0

原创 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 adirectfr...

2019-09-18 12:31:28 40 0

原创 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 fore...

2019-09-17 21:51:11 47 0

原创 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 targ...

2019-09-16 14:24:42 47 0

原创 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...

2019-09-16 13:39:31 55 0

原创 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->3...

2019-09-01 19:42:29 40 0

原创 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...

2019-09-01 19:27:04 151 0

原创 LeetCode 130 Surrounded Regions (DFS)

Given a 2D board containing'X'and'O'(the letter O), capture all regions surrounded by'X'. A region is captured by flip...

2019-08-31 18:28:41 47 0

原创 LeetCode 637 Average of Levels in Binary Tree (BFS)

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

2019-08-31 00:23:00 52 0

原创 LeetCode 103 Binary Tree Zigzag Level Order Traversal (BFS)

Given a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then right to left for the next level ...

2019-08-29 22:09:39 32 0

原创 HDU 6194 string string string (后缀数组 + 线段树 + 容斥)

string string string Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3492Accepted Submission(s)...

2019-08-27 13:28:48 39 0

原创 Codeforces 427D Match & Catch (后缀数组)

D. Match & Catch time limit per test: 1 second memory limit per test: 512 megabytes Police headquarter is monitoring signal on different frequ...

2019-08-25 11:34:04 77 0

原创 luogu 2408 不同子串个数 (后缀数组)

题目背景 因为NOI被虐傻了,蒟蒻的YJQ准备来学习一下字符串,于是它碰到了这样一道题: 题目描述 给你一个长为N的字符串,求不同的子串的个数 我们定义两个子串不同,当且仅当有这两个子串长度不一样 或者长度一样且有任意一位不一样。 子串的定义:原字符串中连续的一段字符组成的字符串 输入...

2019-08-20 10:18:10 68 0

原创 hihocoder 1415 后缀数组三·重复旋律3 (后缀数组 + 二分 经典问题)

时间限制:5000ms 单点时限:1000ms 内存限制:256MB 描述 小Hi平时的一大兴趣爱好就是演奏钢琴。我们知道一个音乐旋律被表示为长度为 N 的数构成的数列。小Hi在练习过很多曲子以后发现很多作品中的旋律有共同的部分。 旋律是一段连续的数列,如果同一段旋律在作品A和作品B中同...

2019-08-19 21:57:35 39 0

原创 hihocoder 1407 后缀数组二·重复旋律2 (后缀数组 + 二分)

时间限制:5000ms 单点时限:1000ms 内存限制:256MB 描述 小Hi平时的一大兴趣爱好就是演奏钢琴。我们知道一个音乐旋律被表示为长度为 N 的数构成的数列。小Hi在练习过很多曲子以后发现很多作品自身包含一样的旋律。 旋律可以表示为一段连续的数列,相似的旋律在原数列不可重叠,...

2019-08-19 14:52:22 36 0

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