【题目】
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.
If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is.
You may not alter the values in the nodes, only n...
分类:
其他好文 时间:
2014-05-18 10:22:34
阅读次数:
367
题意:
Evaluate the value of an arithmetic expression in
Reverse Polish Notation.
Valid operators are +, -, *,
/. Each operand may be an integer or another expression.
So...
分类:
其他好文 时间:
2014-05-18 08:09:15
阅读次数:
190
Wrote by mutouyun. (http://darkc.at/a-tricky-code/)
刚刚在网上闲逛,看到reddit上关于最受欢迎的代码的讨论贴,上面有一小段非常有意思的代码:
unsigned int v; // to count the number of bits set in v
unsigned int c; // c accumulates the ...
分类:
其他好文 时间:
2014-05-18 07:44:31
阅读次数:
284
题目:
Given an input string, reverse the string word by word.
For example,
Given s = "the sky is blue",
return "blue is sky the".
Clarification:
What constitutes a word?
A sequence of non-spa...
分类:
其他好文 时间:
2014-05-18 04:12:07
阅读次数:
198
Given a linked list, reverse the nodes of a
linked list k at a time and return its modified list.If the number of nodes is
not a multiple of k then le...
分类:
其他好文 时间:
2014-05-18 01:53:53
阅读次数:
331
sorted函数:iterable:是可迭代类型;cmp:用于比较的函数,比较什么由key决定,有默认值,迭代集合中的一项;key:用列表元素的某个属性和函数进行作为关键字,有默认值,迭代集合中的一项;reverse:排序规则.
reverse = True 或者 reverse = False,有...
分类:
编程语言 时间:
2014-05-17 23:36:24
阅读次数:
511
设置Navigation Bar 透明
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);或者Theme中添加 true
/**
* Convenience function to set the flag bits as specified in flags, as
...
分类:
移动开发 时间:
2014-05-15 18:15:56
阅读次数:
631
经历了三道树的题后,完全崩溃中,急需一道非树图的题来挽救信心。题目:反转数字。input : 123
, output : 321.思路:直接,没什么好说的。自己代码:很龊,有大量的冗余信息,还申请了一个List,虽然AC了,但有很大改进空间。public
int reverse(int x) { ...
分类:
其他好文 时间:
2014-05-15 14:22:31
阅读次数:
212
join()Array.join(/*optional*/separator)将数组转换为字符串,可带一个参数separator(分隔符,默认为“,”)。与之相反的一个方法是:String.splict(),将字符串分隔成若干块来创建一个新的数组。reverse()Array.reverse(),颠倒数组元素的顺序,返回逆向的数组.注意此方法会修..
分类:
编程语言 时间:
2014-05-15 00:31:23
阅读次数:
441
【题目】
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
【题意】
反转int型整数,输出的也是int型的整数
【思路】
如要考虑两种特殊情况:
1. 类似100这样的整数翻转之后为1
2. 翻转之后的值溢出该如何处理,
本题的测试用例中似乎没有给出溢出的情况
...
分类:
其他好文 时间:
2014-05-14 20:41:19
阅读次数:
244