摘要: Given an absolute path for a file (Unix-style), simplify it.For example,path="/home/", =>"/home"path="/a/./b/../../c/", =>"/c"click to show corner cas... 阅读全文
posted @ 2014-10-29 20:52 george_cw 阅读(173) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkthen left-o... 阅读全文
posted @ 2014-10-26 14:51 george_cw 阅读(148) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 ... 阅读全文
posted @ 2014-10-26 13:09 george_cw 阅读(143) 评论(0) 推荐(0) 编辑
摘要: Reverse Words in a StringGiven an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the". 1 cl... 阅读全文
posted @ 2014-10-19 01:42 george_cw 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 当在tablelayout中显示图片时,设置imageView为固定大小时,会出现divide by zero 错误将LayoutParams 改为 TableRow.LayoutParams即可TableRow.LayoutParams params = new TableRow.LayoutPa... 阅读全文
posted @ 2014-10-02 09:33 george_cw 阅读(738) 评论(0) 推荐(0) 编辑
摘要: 一笔画问题时间限制:3000ms | 内存限制:65535KB难度:4描述zyc从小就比较喜欢玩一些小游戏,其中就包括画一笔画,他想请你帮他写一个程序,判断一个图是否能够用一笔画下来。规定,所有的边都只能画一次,不能重复画。输入第一行只有一个正整数N(N 2 bool visited[1005] =... 阅读全文
posted @ 2014-09-14 10:19 george_cw 阅读(307) 评论(0) 推荐(0) 编辑
摘要: 汉诺塔(三)时间限制:3000ms | 内存限制:65535KB难度:3描述在印度,有这么一个古老的传说:在世界中心贝拿勒斯(在印度北部)的圣庙里,一块黄铜板上插着三根宝石针。印度教的主神梵天在创造世界的时候,在其中一根针上从下到上地穿好了由大到小的64片金片,这就是所谓的汉诺塔。不论白天黑夜,总有... 阅读全文
posted @ 2014-08-31 23:01 george_cw 阅读(250) 评论(0) 推荐(0) 编辑
摘要: 前缀式计算时间限制:1000ms | 内存限制:65535KB难度:3描述先说明一下什么是中缀式:如2+(3+4)*5这种我们最常见的式子就是中缀式。而把中缀式按运算顺序加上括号就是:(2+((3+4)*5))然后把运算符写到括号前面就是+(2 *( +(3 4) 5) )把括号去掉就是:+ 2 *... 阅读全文
posted @ 2014-08-30 23:45 george_cw 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 我国公民的身份证号码特点如下:1、 长度为18位;2、 第1~17位只能为数字;3、 第18位可以是数字或者小写英文字母x。4、 身份证号码的第7~14位表示持有人生日的年、月、日信息。例如:511002198808080111或51100219880808011x。请实现身份证号码合法性判断的函数... 阅读全文
posted @ 2014-08-28 23:29 george_cw 阅读(2226) 评论(0) 推荐(0) 编辑
摘要: 将一个字符串的元音字母复制到另一个字符串,并排序(30分)问题描述:有一字符串,里面可能包含英文字母(大写、小写)、数字、特殊字符,现在需要实现一函数,将此字符串中的元音字母挑选出来,存入另一个字符串中,并对字符串中的字母进行从小到大的排序(小写的元音字母在前,大写的元音字母在后,依次有序)。说明:... 阅读全文
posted @ 2014-08-28 20:37 george_cw 阅读(504) 评论(0) 推荐(0) 编辑