备忘
爱我洋洋老婆
年龄大了,烦恼多了,找个旧博客记忆曾经的年青岁月
展开
-
收集面试题(七)(查看是否包含字符串)
ot, compare)); } public static boolean compareString(String root, String compare) { if (compare.length() > root.length()) { return false; } String fatherStr = root.concat(root); if (fatherStr.contains(compare)) { return t原创 2009-03-20 11:58:16 · 51 阅读 · 0 评论 -
SQL面试题(十三)
------+-|1 |2 |2 |+---+-----+------+ 建表: Create table d(id int,name varchar(50)); insert into d values(1,'gly'); insert into d values(2,'ptgly'); insert into原创 2009-03-31 16:34:39 · 56 阅读 · 0 评论 -
SQL面试题(十四)
如何实现? 建表: DROP TABLE IF EXISTS `comparetable`; CREATE TABLE `comparetable` ( `Id` int(11) NOT NULL auto_increment, `name` varchar(12) default NULL, `moneys1` int(11) default NULL, `moneys2` int(11)原创 2009-03-31 16:53:50 · 53 阅读 · 0 评论 -
SQL面试题(十五)
t, `name` varchar(12) default NULL, `object` varchar(12) default NULL, `info` int(11) default NULL, PRIMARY KEY (`Id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; INSERT INTO `samedata` VALUES (1,'A','love',90); INSERT INTO `samedata` VALUES (2,'原创 2009-04-07 13:12:45 · 63 阅读 · 0 评论 -
SQL面试题(十六)
d为付款编号,PK:bill_id bill_id INTEGER charge INTEGER pay_id INTEGER &am原创 2009-04-07 13:17:21 · 61 阅读 · 0 评论 -
SQL面试题(十八)
2008/10/10 10:03:00 1 2008/10/10 10:09:00 2 2008/10/10 10:10:00 2 2008/10/10 10:11:00 ...... ---------------------------原创 2009-04-07 15:08:08 · 64 阅读 · 0 评论 -
收集面试题(十五)(生成杨辉三角)
* the arguments */ public static void main(String[] args) { new YangHuiTriangle().printYanghuiTriangle(10); } /** * 生成指定行数的杨辉三角形 * * @param lines * 杨辉三角形的行数 */ public void printYanghuiTriangle(int原创 2009-10-19 13:08:21 · 72 阅读 · 0 评论 -
收集面试题(十六)(指定盒子分苹果)
。 // 请问这10个盒子应该分别装多少苹果? // 扩展到n,得出方式,只是需要多少盒子,怎么分配。 public class SplitNumber { /** * @param args */ public static void main(String[] args) { split(600); } /** * Split. * * @param n * the n */ public static原创 2009-10-19 13:12:57 · 104 阅读 · 0 评论 -
收集面试题(十七)(分数使之有倍数关系)
原创 2009-10-19 13:17:13 · 70 阅读 · 0 评论 -
收集面试题(十八)(数组拷贝)
原创 2009-10-19 14:10:10 · 70 阅读 · 0 评论 -
收集面试题(十九)(统计字符串中相同字符的个数)
d. * * @param args * the arguments */ public static void main(String[] args) { String str = "yu#$SdwssddddDDDddasasas"; countChar(str); System.out.println("#####################################"); c原创 2009-10-19 14:19:35 · 124 阅读 · 0 评论 -
收集面试题(二十)(取数组最大和次最大值)
原创 2009-10-19 14:45:37 · 65 阅读 · 0 评论 -
收集面试题(二十一)(取素数)
;Integer> result = new ArrayList<Integer>(); for (Integer info : arrays) { if (info > 101) { result.add(info); } } System.out.println(result); } private static List<Integer> getPrime原创 2009-10-19 14:47:05 · 47 阅读 · 0 评论 -
收集面试题(二十二)(插入字符串)
/** * 插入字符串 */ public static String insert(String info, String insert, int index) { if (info == null || insert == null) { throw new NullPointerException( "the insert string is null or the info string is null."); }原创 2009-10-19 15:32:18 · 51 阅读 · 0 评论 -
收集面试题(二十三)(替换字符串)
(info, "st", "$$")); } public static String replace(String source, String toReplace, String replace) { if (source == null || toReplace == null || replace == null) { throw new RuntimeException("null is not allow."原创 2009-10-19 15:38:50 · 79 阅读 · 0 评论 -
收集面试题(二十五)(关于Override的测试)
原创 2009-10-19 16:16:15 · 49 阅读 · 0 评论 -
收集面试题(二十六)(关于构造函数的测试)
{ System.out.println("A(String)"); } } class B extends A { public B() { System.out.println("B()"); } public B(String s) { System.out.println("B(String)"); } } 输出结果为: A()B()A()B(String)原创 2009-10-19 16:17:41 · 51 阅读 · 0 评论 -
收集面试题(二十七)(关于StringBuffer的测试)
est test = new StringBufferTest(); StringBuffer x = new StringBuffer("A"); StringBuffer y = new StringBuffer("B"); test.method(x, y); System.out.println(x + "," + y); } } 输出结果为 AB,B原创 2009-10-19 16:21:41 · 62 阅读 · 0 评论 -
SQL面试题(十二)
701 45.2 2004-10-01 1234 567890 66.5 2004-9-21 3456 789065 22.5 2004-10-01 3456 789065 77.5 2004-10-27 3456 678901 48.5 200原创 2009-03-31 16:29:25 · 57 阅读 · 0 评论 -
SQL面试题(十一)
3 3 b b b 3 3 b b b 3 3 b b b 3 3 b b b 3 3 c c c 4 4 d d d 5 5 d d d 5 5 建表: DROP TABLE IF EXISTS `samedatas`; CREATE TABLE `samedatas` ( `Id` int(11) NOT NULL auto_increment, `a` varchar(11) default NULL, `b` varchar(11) default原创 2009-03-31 16:19:01 · 47 阅读 · 0 评论 -
SQL面试题(十)
reate table dept ( deptno int not null, deptname char(20), deptlocation char(50), primary key (deptno) ); create table emp ( empno int not null, deptno int, em原创 2009-03-31 16:00:35 · 49 阅读 · 0 评论 -
排序备忘
s) { int[] arrs = new int[] { 121, 32, 14, 125, 638, 119, 230, 469 }; bubbleSort(arrs.clone()); selectSort(arrs.clone()); insertSort(arrs.clone()); shellSort(arrs.clone()); System.out.println("quick sort start: "); display(原创 2009-03-20 13:18:10 · 40 阅读 · 0 评论 -
收集面试题(八)(生成指定规则数字)
e int[] numbers = new int[] { 1, 2, 2, 3, 4, 5 }; public int n; private String lastResult = ""; private boolean validate(String s) { if (s.compareTo(lastResult) = 0 || s.indexOf("53") >= 0) return false; return true原创 2009-03-20 13:20:25 · 50 阅读 · 0 评论 -
收集面试题(九)(取得链表的指定数)
tNode; } /**得到链表的总数,正向计数得到总数-k*/ private static int findNode(Node headNode, int k) { int count = 0; Node node = headNode; while (node.nextNode != null) { count++; node = node.nextNode; } if (k >= count) { return 0;原创 2009-03-20 13:22:05 · 40 阅读 · 0 评论 -
收集面试题(十)(取得最大子数组)
原创 2009-03-20 13:57:03 · 50 阅读 · 0 评论 -
收集面试题(十一)(两个大数相加)
} public String add(String a, String b) { // 检查输入 if (!a.matches("\\d+") || !a.matches("\\d+")) { return null; } final int BASE = 10;// 10进制 int lenA = a.length();// 加数的长度 int lenB = b.length();// 被加数的长度 in原创 2009-03-20 14:17:34 · 66 阅读 · 0 评论 -
收集面试题(十二)(字符串反转)
tatic void main(String[] args) { System.out.println(reverseStack("wokessd.cm .cok .ddj dd*&4 dlk")); System.out.println(reverseDeque("wokessd.cm .cok .ddj dd*&4 dlk")); System.out.println(reverse("wokessd.cm .cok .原创 2009-03-20 16:23:38 · 75 阅读 · 0 评论 -
收集面试题(十三)(删除相邻重复数字)
[code="java"]package arraytest; import java.util.ArrayList; import java.util.List; public class DeleteNumber { /** * @param args */ public static void main(String[] args) { List allNums = new ArrayList(); allNums.add(1)原创 2009-03-20 16:49:19 · 204 阅读 · 0 评论 -
收集面试题(十四)(母牛问题)
,第20年头上共有多少头母牛? public class CowCount { public static void main(String[] args) { int year = 20; ArrayList<Cow> cows = new ArrayList<Cow>(); cows.add(new Cow(3)); for (int i = 0; i < year; i++) {原创 2009-03-20 17:00:07 · 116 阅读 · 0 评论 -
SQL面试题(一)
有传入数据库的数据都要过滤,安全检查和类型检查 5.数据库设计就是尽可能少直接操作大数据字段,需要反复使用的尽可能和很少使用的大字段分离 6.select 子句中避免使用 '* ' 7.减少访问数据库的次数 8.整合简单 , 无关联的数据库访问 9.用 TRUNCATE 替代 DELETE(全表时使用,不回滚) 10.尽量多使用 COMMIT 11.用 Where 子句替换 HAVING 子句 12.用 EXISTS 替换 DISTINCT 13.sql 语句用大写的 14.避免在索引列上使用计算 避免在索原创 2009-03-31 14:10:41 · 48 阅读 · 0 评论 -
SQL面试题(二)
; 2B 乙 4C&nbs原创 2009-03-31 14:19:31 · 50 阅读 · 0 评论 -
SQL面试题(三)
ngwu 6789 C 4 liumazi 4587 C 5 dongjiu 3298 B 6 shiga 4567 A 创建表: DROP TABLE IF EXISTS `workshow`; CREATE TABLE `workshow` ( `Id` int(原创 2009-03-31 14:28:21 · 65 阅读 · 0 评论 -
SQL面试题(四)
sp; 1 | 2328.00 | | 2 | 2004 | 2 | 3822.00 | | 3 | 2004 | &原创 2009-03-31 14:38:15 · 44 阅读 · 0 评论 -
SQL面试题(五)
原创 2009-03-31 14:42:29 · 82 阅读 · 0 评论 -
SQL面试题(六)
,有无下级 1 a 有 2 b 无 11 c 原创 2009-03-31 14:46:59 · 57 阅读 · 0 评论 -
SQL面试题(七)
(10),hetongkuan varchar(10)); create table inmoney(id varchar(10),hetongid varchar(10),money varchar(10)); insert into project values("1","pro1"); insert into project values("2","pro2"); insert into project value原创 2009-03-31 15:19:06 · 59 阅读 · 0 评论 -
SQL面试题(八)
原创 2009-03-31 15:31:42 · 47 阅读 · 0 评论 -
SQL面试题(九)
的都要 输出) 建表: create table doubleprint (id integer not null); insert into doubleprint values (1) ,(2),(3), (4),(5),(4),(1),(7), (9),(4),(3),(11); 解答Sql: select id from doubleprint where (select count(id) fr原创 2009-03-31 15:54:57 · 38 阅读 · 0 评论 -
收集面试题(二十八)(关于Comparator和Comparable的比较)
nt getAge() { return age; } public void setAge(int age) { this.age = age; } public String getId() { return id; } public void setId(String id) { this.id = id; } } import java.util.Arrays; /** * 强行对实现它的每个类的对象进行整体排序原创 2009-10-19 16:47:59 · 92 阅读 · 0 评论