Sort a linked list using insertion sort.
class Solution {
public:
ListNode *insertionSortList(ListNode *head) {
if(head == NULL || head->next == NULL)
return head;
Lis...
分类:
其他好文 时间:
2014-07-15 12:22:53
阅读次数:
244
先写下这个问题的模式
def preorderTraversal(self, root):
if root == None: return []
re = []
insert root to stack s
while s not empty:
cur_root = top of stack s
s.pop()
how to handle cur_root
how to ...
分类:
其他好文 时间:
2014-07-15 10:17:43
阅读次数:
274
控制传递语句(Control Transfer Statements)
控制转移语句改变你代码的执行顺序,通过它你可以实现代码的跳转。Swift有四种控制转移语句。
continue
break
fallthrough
return
我们将会在下面讨论continue、break和fallthrough语句。return语句将会在函数章节讨论。
Continue
...
分类:
其他好文 时间:
2014-07-14 20:37:17
阅读次数:
340
public static String toHexString2(byte[] b) {
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < b.length; ++i) {
buffer.append(toHexString2(b[i]));
}
return buffer.toString();
...
分类:
编程语言 时间:
2014-07-14 18:22:33
阅读次数:
244
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).
For example:
Given binary tree {3,9,20,#,#,15,7},
...
分类:
其他好文 时间:
2014-07-14 17:31:14
阅读次数:
229
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).
For example:
Given binary tree {3,9,20,#,#,15,7},
3
/ 9 20
...
分类:
其他好文 时间:
2014-07-14 17:29:03
阅读次数:
166
#@ root: the root of searched tree
#@ nodeToFind: the tree-node to be found
#@ path: the path from root to node
#@@
#@@ search tree referenced by root, and return the path
#@@ from root to node, if n...
分类:
其他好文 时间:
2014-07-14 16:45:51
阅读次数:
217
应用项目需要要屏蔽HOME键。项目本身的要求是让按下HOME键后程序不做任何响应,就像按下返回键一样在onBackPressed 方法中直接return啥都不做。紧跟着去google,百度翻了个遍也没有找到解决的方法,最坑爹的是一些无良的网友在没有自己亲自测试的情况下转发许多不靠谱的解决方式,浪费了大家好多时间。而且自己刚接触Android两三个月也不太了解不同的版本之前权限是不一样的。...
分类:
其他好文 时间:
2014-07-14 16:45:14
阅读次数:
241
#!/usr/bin/pythonimportredefbuffer_line():buf=open("/etc/sae/buffer_1").read()ifnotbuf:return0else:returnint(re.findall("^\d*",buf)[0])defset_last_pos(pos):open("/etc/sae/buffer_1","w").write(str(pos))if__name__==‘__main__‘:appname={}fh=open("/data0/l7.acce..
分类:
编程语言 时间:
2014-07-14 16:41:57
阅读次数:
319
ios6和ios7禁止屏幕旋转- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{ return(toInterfaceOrientation ==UIInterf...
分类:
移动开发 时间:
2014-07-14 15:44:43
阅读次数:
329