一个.java源文件中可以有多个类吗?(内部类除外)有什么条件?带着这个疑惑,动手建几个测试类,揭开心中的疑惑。以下是解开疑惑过程:package
test;/*** 一个.java源文件中可以有多个类吗?(内部类除外)有什么条件?* 可以的*但是只能有一个public类, 而且如果有public类...
分类:
编程语言 时间:
2014-05-17 15:19:06
阅读次数:
261
【题目】
给定两个字符串s1和s2,要求判断s2是否能够被通过s1做循环移位(rotate)得到的字符串包含。例如,S1=AABCD和s2=CDAA,返回true;给定s1=ABCD和s2=ACBD,返回false。
【分析】
【思路一】
从题目中可以看出,我们可以使用最直接的方法对S1进行循环移动,再进行字符串包含的判断,从而遍历其所有的可能性。
字符串循环移动,时间复杂度为O(n...
分类:
其他好文 时间:
2014-05-16 02:56:14
阅读次数:
305
【题目】
原文:
1.8 Assume you have a method isSubstring which checks if one word is a substring of another. Given two strings, s1 and s2, write code to check if s2 is a rotation of s1 using only one...
分类:
其他好文 时间:
2014-05-16 01:50:08
阅读次数:
311
【题目】
Given an integer, convert it to a roman numeral.
Input is guaranteed to be within the range from 1 to 3999.
【题意】
给定一个整数,将其表示成罗马数字
【思路】
罗马数字中只使用如下七个基值字母:M,D,C,L,X,V,I,分别用来表示1000、500、100、50、10、5、1。
罗马数组数规则:
基本数字Ⅰ、X 、C 中的任何一个,自身连用构成数目,或者放在大数的右边连用...
分类:
其他好文 时间:
2014-05-16 01:46:55
阅读次数:
312
【题目】
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a contain...
分类:
其他好文 时间:
2014-05-16 01:32:47
阅读次数:
406
最近参加了4、5场面试,总结一下竞聘oracle 开发岗位最长问到哪些问题:
1、delete 与 truncate 区别?
1)truncate 是DDL语句,delete 是DML语句;
2)truncate 速度远快于 delete;
原因是:当我们执行delete操作时所有表数据先被copy到回滚表空间,数据量不同花费时间长短不一。而truncate是直接删除数据不进回滚表...
分类:
数据库 时间:
2014-05-15 23:39:29
阅读次数:
450
自己的笔记:
内部的访问规则:
内部类可以直接访问外部类的成员,包括私有。
外部类要想访问内部类,必须建立对象。
之所以可以直接访问外部类的成员,因为内部类持有外部类的引用,格式:Outer.this.x
访问格式:
在内部类定义在外部类中的成员位置上,而且是非...
分类:
其他好文 时间:
2014-05-15 23:22:37
阅读次数:
343
题目链接:
http://poj.org/problem?id=1082
Calendar Game
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 4742
Accepted: 2236
Description
Adam and...
分类:
其他好文 时间:
2014-05-15 20:33:25
阅读次数:
223
这一篇文章专门整理一下研究过的Android面试题,内容会随着学习不断的增加,如果答案有错误,希望大家可以指正
1.简述Activity的生命周期
当Activity开始启动的时候,首先调用onCreate(),onStart(),onResume()方法,此时Activity对用户来说,是可见的状态
当Activity从可见状态变为被Dialog遮挡的状态的时候,会调用on...
分类:
移动开发 时间:
2014-05-15 20:32:49
阅读次数:
348