上一页 1 2 3 4 5 6 7 8 9 10 ··· 15 下一页
摘要: There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity sh 阅读全文
posted @ 2019-01-19 11:44 TobicYAL 阅读(159) 评论(0) 推荐(0) 编辑
摘要: Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer 阅读全文
posted @ 2019-01-11 15:06 TobicYAL 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 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 contai 阅读全文
posted @ 2019-01-11 14:37 TobicYAL 阅读(123) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have ex 阅读全文
posted @ 2019-01-11 14:02 TobicYAL 阅读(145) 评论(0) 推荐(0) 编辑
摘要: Description For the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides to organize a g 阅读全文
posted @ 2019-01-05 21:18 TobicYAL 阅读(268) 评论(0) 推荐(0) 编辑
摘要: 适用 含负权边的有向图的单源最短路径问题 不能处理带负权边的无向图和包含权值总和为负值的回路 数据结构 dist[u] :源点到u的最短路径长度 思路 每次更新dist数组,使得 dist[u] 的含义是从源点到u的经过n条边的最短路径长度 递推公式 $Dist^k[u]=min(dist^{k-1 阅读全文
posted @ 2018-12-30 19:14 TobicYAL 阅读(333) 评论(0) 推荐(0) 编辑
摘要: 数据结构 dfn[i] :编号为i的结点在dfs遍历图的过程中的访问序号(开始时间) low[i] :从i结点出发dfs过程中i下方的结点能到达的最早的当前搜索路径上的结点的开始时间。(初始时 low[i]=dfn[i] ) 操作 遍历结点没被访问过的就开始dfs,碰到哪个结点哪个结点就入栈,栈中结 阅读全文
posted @ 2018-12-30 18:01 TobicYAL 阅读(575) 评论(0) 推荐(0) 编辑
摘要: Trie树(字典树) 树中任一结点p都对应于一个字符串S,S由从根出发走到p所经过的边上的字符构成 数据结构 操作 插入串 (复杂度为模式串长度) Trie图(AC自动机) 可以由Trie树为基础构造 终止节点:每个模式串最后一个结点 危险结点:终止节点和前缀指向危险结点的结点。 包含前缀指针(ne 阅读全文
posted @ 2018-12-30 16:29 TobicYAL 阅读(532) 评论(0) 推荐(0) 编辑
摘要: 每个非叶结点所表示的结点$[a,b]$,左儿子表示区间$[a,\frac{a+b}{2}]$,右儿子表示的区间为$[\frac{a+b}{2}+1,b]$ 叶子结点表示区间长度为1 数据结构 用一维数组存放线段树(idx)时,数组开到4n大可以确保不越界。 操作 区间分解 从根节点开始递归进行区间分 阅读全文
posted @ 2018-12-30 15:14 TobicYAL 阅读(445) 评论(0) 推荐(0) 编辑
摘要: 描述 The GX Light Pipeline Company started to prepare bent pipes for the new transgalactic light pipeline. During the design phase of the new pipe shape 阅读全文
posted @ 2018-12-25 16:43 TobicYAL 阅读(255) 评论(0) 推荐(0) 编辑
摘要: 描述 The main land of Japan called Honshu is an island surrounded by the sea. In such an island, it is natural to ask a question: “Where is the most dis 阅读全文
posted @ 2018-12-25 16:37 TobicYAL 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 描述 Being the only living descendant of his grandfather, Kamran the Believer inherited all of the grandpa's belongings. The most valuable one was a pie 阅读全文
posted @ 2018-12-25 16:33 TobicYAL 阅读(321) 评论(0) 推荐(0) 编辑
摘要: 题目描述 Farmer John has noticed that his cows often move between nearby fields. Taking this into account, he wants to plant enough grass in each of his f 阅读全文
posted @ 2018-12-22 11:13 TobicYAL 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 描述 人们熟悉的四则运算表达式称为中缀表达式,例如(23+34*45/(5+6+7))。在程序设计语言中,可以利用堆栈的方法把中缀表达式转换成保值的后缀表达式(又称逆波兰表示法),并最终变为计算机可以直接执行的指令,得到表达式的值。给定一个中缀表达式,编写程序,利用堆栈的方法,计算表达式的值。输入第 阅读全文
posted @ 2018-12-21 23:15 TobicYAL 阅读(383) 评论(0) 推荐(0) 编辑
摘要: 题目描述 农民约翰的农场里有N座山峰(1<=N<=1000),每座山都有一个在0到100之间的整数的海拔高度。在冬天,因为山上有丰富的积雪,约翰经常开办滑雪训练营。 不幸的是,约翰刚刚得知税法在滑雪训练营方面有新变化,明年开始实施。在仔细阅读法律后,他发现如果滑雪训练营的最高和最低的山峰海拔高度差大 阅读全文
posted @ 2018-12-21 15:46 TobicYAL 阅读(302) 评论(0) 推荐(0) 编辑
摘要: 题目描述 After realizing that there is much money to be made in software development, Farmer John has launched a small side business writing shortprograms 阅读全文
posted @ 2018-12-21 12:41 TobicYAL 阅读(488) 评论(0) 推荐(0) 编辑
摘要: 描述 After going through the receipts from your car trip through Europe this summer, you realised that the gas prices varied between the cities you visi 阅读全文
posted @ 2018-12-20 17:35 TobicYAL 阅读(376) 评论(0) 推荐(0) 编辑
摘要: 描述 Let us consider a special type of a binary search tree, called a cartesian tree. Recall that a binary search tree is a rooted ordered binary tree, 阅读全文
posted @ 2018-12-20 17:31 TobicYAL 阅读(1036) 评论(0) 推荐(0) 编辑
摘要: 描述 输入 包括多组数据,每组数据的第一行是整点的个数n(1<=n<=1000),其后n行每行由两个整数组成,表示一个点的x、y坐标。输入保证一组数据中不会出现相同的点,且坐标的绝对值小于等于20000。输入以一组n=0的数据结尾。输出对于每组输入数据,输出一个数,表示这组数据中的点可以组成的正方形 阅读全文
posted @ 2018-12-20 17:29 TobicYAL 阅读(356) 评论(0) 推荐(0) 编辑
摘要: 描述 给定N个数的序列a1,a2,...aN,定义一个数对(ai, aj)为“重要逆序对”的充要条件为 i < j 且 ai > 2aj。求给定序列中“重要逆序对”的个数。 输入 第一行为序列中数字的个数N(1 ≤ N ≤ 200000)。第二行为序列a1, a2 ... aN(0 ≤a ≤ 100 阅读全文
posted @ 2018-12-20 17:26 TobicYAL 阅读(902) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 15 下一页