
算法 algorithm
文章平均质量分 58
yongheng5871
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
后缀树
这道题是codechef上九月月赛的一道压轴题目,题意很简单,就是时时刻刻求一个字符串的所有不同字串个数,支持动态末尾添加字符与前端删除字符功能。题目链接: http://www.codechef.com/problems/TMP01/以前还以为后缀自动机可以秒杀一切字符串,后来才发现自己是那样的天真。 无论是后缀数组还是后缀树或者是后缀自动机,他们可以说都是处理字符串题目的一个非常强原创 2013-09-22 12:50:43 · 1100 阅读 · 0 评论 -
Leetcode 2:Add Two Numbers
ProblemYou are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as原创 2015-07-15 10:11:44 · 389 阅读 · 0 评论 -
Leetcode 3: Longest Substring Without Repeating Characters
ProblemGiven a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for “abcabcbb” is “abc”, which the length is 3原创 2015-07-15 10:27:58 · 482 阅读 · 0 评论 -
LeetCode 1: Two Sum
LeetCode 1: Two SumProblemGiven an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add原创 2015-07-14 20:05:13 · 393 阅读 · 0 评论 -
Leetcode 4: Median of Two Sorted Arrays
ProblemThere 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 should be O(log (m+n)).AnswerComplexity: O(log原创 2015-07-15 14:11:24 · 450 阅读 · 0 评论 -
Leetcode 5: Longest Palindromic Substring
ProblemGiven a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.AnswerComplexity: O(原创 2015-07-16 08:50:48 · 588 阅读 · 0 评论 -
计蒜客2015 初赛题解及代码
2015 计蒜客初赛题解标签(空格分隔): ACM—题解思路工作区的颜值选择简单数据 暴力代码#include <iostream>#include <cstdio>using namespace std;const int Maxn = 2, Maxm = 3;int C[Maxn][Maxm], U[Maxn][Maxm], W[Maxn][Maxm];int n, m, k;i原创 2016-06-14 23:04:05 · 735 阅读 · 0 评论