Permutation SequenceThe set[1,2,3,…,n]contains a total ofn! unique permutations.By listing and labeling all of the permutations in order,We get the fo...
分类:
其他好文 时间:
2014-07-23 22:11:47
阅读次数:
327
#pragma warning(disable:4996)
#include <Windows.h>
#include <tchar.h>
#include <cstdio>
/*
submit time : 1
request :
Follow up for N-Queens problem.
Now, instead outputting board configura...
分类:
其他好文 时间:
2014-07-23 18:13:56
阅读次数:
284
题目来源:吉哥系列故事——完美队形II
题意:中文
思路:在manacher算法向两边扩展的时候加判断 保证非严格递减就行了
#include
#include
#include
using namespace std;
const int maxn = 100110;
int a[maxn<<1];
int b[maxn<<1];
int dp[maxn<<1];
int manac...
分类:
其他好文 时间:
2014-07-23 17:18:54
阅读次数:
381
函数实现原理如下:在当前序列中,从尾端往前寻找两个相邻元素,前一个记为*i,后一个记为*ii,并且满足*i =0;i--) { if(num[i]=0;i--) { if(num[i]>num[p]) break; ...
分类:
其他好文 时间:
2014-07-23 16:14:51
阅读次数:
171
题目:Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Follow up:Can you solve it without using extra spac....
分类:
编程语言 时间:
2014-07-23 12:02:46
阅读次数:
304
题目:Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?题解:这道题连带着II是很经典的,在看CC150时候,纠结这个问题纠结了很久....
分类:
编程语言 时间:
2014-07-23 12:02:26
阅读次数:
311
题目:Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example,Given 1....
分类:
编程语言 时间:
2014-07-23 12:01:46
阅读次数:
312
题目
Given an array of integers, every element appears three times except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it wit...
分类:
其他好文 时间:
2014-07-23 00:13:17
阅读次数:
331
题目:Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Write a funct....
分类:
编程语言 时间:
2014-07-22 22:47:55
阅读次数:
214
Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2]have the following unique perm...
分类:
其他好文 时间:
2014-07-22 22:32:33
阅读次数:
247