LeetCode&AC
慢慢来比较快
不拼搏,枉少年。
展开
-
ACM枚举法知识点和练习
1.枚举法思想简介基本思想:枚举也称作穷举,指的是从问题所有可能的解的集合中一一枚举各元素。用题目中给定的检验条件判定哪些是无用的,哪些是有用的。能使命题成立。即为其解。枚举法优缺点: 优点:算法简单,在局部地方使用枚举法,效果会十分的好 缺点:运算量过大,当问题的规模变大的时候,循环的阶数越大,执行速度越慢。计算量容易过大枚举法初体验:原创 2013-11-06 01:49:52 · 866 阅读 · 0 评论 -
POJ1543 + 1013 解题报告
考察点:枚举法 传送门:http://poj.org/problem?id=1543 题目描述:DescriptionFor hundreds of years Fermat's Last Theorem, which stated simply that for n > 2 there exist no integers a, b, c > 1原创 2013-11-08 00:36:09 · 649 阅读 · 0 评论 -
POJ熄灯问题(枚举法)
枚举法练习:题目:有一个由按钮组成的矩阵,其中每行有6个按钮,共5行。每个按钮的位置上有一盏灯。当按下一个按钮后,该按钮以及周围位置(上边、下边、左边、右边)的灯都会改变一次。即,如果灯原来是点亮的,就会被熄灭;如果灯原来是熄灭的,则会被点亮。在矩阵角上的按钮改变3盏灯的状态;在矩阵边上的按钮改变4盏灯的状态;其他的按钮改变5盏灯的状态。2811:熄灯问题" title="POJ原创 2013-11-12 17:10:54 · 1004 阅读 · 0 评论 -
LeetCode 线性表的操作(Median of Two Sorted Arrays )
1.Median of Two Sorted Arrays 原文链接:点击这里进入 基本内容: There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arra原创 2013-12-09 23:48:50 · 632 阅读 · 0 评论 -
LeetCode(Longest Consecutive Sequence)
1.Longest Consecutive Sequence 原文链接:点击这里进入 基本内容: Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example, Giv原创 2013-12-10 23:11:40 · 777 阅读 · 0 评论 -
LeetCode 线性表的操作(Remove Duplicates)
LeetCode :点击这里进入LeetCode 本文内容 :线性表的操作 相关题目原创 2013-12-05 09:37:17 · 697 阅读 · 0 评论 -
LeetCode 线性表的操作(Search in Rotated Sorted Array )
前面做了下线性表有关的操作,主要是去除线性表中的重复值,(数组和链表),这一篇做两道在线性表中查找的题目。 LeetCode线性表的操作(Remove Duplicates) 1.Search in Rotated Sorted Array 原文链接:点击这里进入 基本内容: Suppose a sorted a原创 2013-12-05 21:38:35 · 559 阅读 · 0 评论 -
LeetCode Next Permutation(下一个排列:常见面试题目)
1.Next Permutation 原文链接:点击这里进入 基本内容: Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangemen原创 2013-12-12 23:23:38 · 12956 阅读 · 5 评论