Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.思路:穷举所有合法的摆法。 1 class Solut...
分类:
其他好文 时间:
2014-08-27 10:54:07
阅读次数:
206
A. Appleman and Easy Tasktime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputToastman came up with a ...
分类:
移动开发 时间:
2014-08-27 09:22:07
阅读次数:
342
使用两个栈实现一个队列
队列是先进先出的数据结构(FIFO),栈是先进后出的数据结构(FILO),
用两个栈来实现队列的最简单方式是:进入队列则往第一个栈压栈,
出队列则将第一个栈的数据依次压入第二个栈,然后出栈.
两条规则:
1)进队列,则直接压入第一个栈
2)出队列,若果第二个栈不为空,直接pop(),如过第二个栈为空,
则把第一个栈中的数据全部压入第二个栈(第一个栈此时为空...
分类:
其他好文 时间:
2014-08-27 01:40:37
阅读次数:
230
应用导航的一致性是整体用户体验的重要组成部分,如果app的导航方式不一样,用户不能很快理解,那么这个应用会让用户有很大的挫败感,大大地影响了用户体验。
Android 3.0后,系统像大家介绍了其在全局导航表现上的重大改变。全面地理解“Back”以及“Up”的导航效果以及意义,能够大大地减少用户的学习时间,用户在使用过程中很快能够学习如何在应用的各个界面间的切换。...
分类:
移动开发 时间:
2014-08-27 01:39:36
阅读次数:
318
LeetCode: Path SumGiven a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equal...
分类:
其他好文 时间:
2014-08-27 00:07:27
阅读次数:
298
题目链接题意 : 把每根棍往地上扔,找出最后在上面的棍,也就是说找出所有的没有别的棍子压在它的上面的棍子。思路 : 对于每根棍子,压在他上面的棍子一定是在它之后扔的棍子,所以在找的时候只要找它之后的线段是否与他相交即可。 1 //2653 2 #include 3 #include 4 #inc.....
分类:
其他好文 时间:
2014-08-26 22:46:16
阅读次数:
243
1.首先上效果图
2.本例实现的效果主要适用于当前页面有多个页签时,进行Fragment切换时,可以利用不同的Menu样式与当前Fragment中的内容进行配合,可以大大增加复用性,看到效果图后,下面我来介绍我实现这一效果的主要步骤
2.1 因为此处我有3个样式,那么我需要在res/menu 文件夹下创建三个文件,style1.xml,style2.xml,style...
分类:
移动开发 时间:
2014-08-26 17:21:06
阅读次数:
359
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 function to determine if a given target is in the...
分类:
其他好文 时间:
2014-08-26 17:19:16
阅读次数:
191
TouchEventTouchEvent 分三种事件:down、move、up。其中move事件在一个操作中(这里说的一个操作就是用户与屏幕的交互,即由down到up的动作序列)可能会发生多次。 但是,我们认为一个动作序列会包含以上三种事件,因此,在事件处理中就是要处理好这个过程,而最重要的就是do...
分类:
移动开发 时间:
2014-08-26 17:16:46
阅读次数:
310
Path SumGiven a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the give...
分类:
其他好文 时间:
2014-08-26 17:05:36
阅读次数:
156