To add up all the numbers in a list, you can use a loop like this: Total is initialized to 0. Each time through the loop, x gets one element...
分类:
其他好文 时间:
2014-07-16 19:29:14
阅读次数:
234
There are several ways to delete elements from a list. If you know the index of the element you want, you can use pop: pop modifies the list...
分类:
其他好文 时间:
2014-07-16 19:26:12
阅读次数:
189
The slice operator can take a third argument that determines the step size, so t[::2] creates a list that contains every other element from t. If the ...
分类:
其他好文 时间:
2014-07-15 09:12:42
阅读次数:
328
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
[LeetCode]Binary Tree Inorder Traversal...
分类:
其他好文 时间:
2014-07-14 16:10:00
阅读次数:
193
描述
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.
Do not allocate extra space for another array, you must do this in ...
分类:
其他好文 时间:
2014-07-14 13:46:43
阅读次数:
229
BACKGROUNDMany algorithms on a graphics processing unit (GPU) may benefit from doing a query in a hierarchical tree structure (including quad-trees, o...
分类:
其他好文 时间:
2014-07-13 19:47:28
阅读次数:
289
Python provides methods that operate on lists. For example, append adds a new element to the end of a list, extend takes a list as an argument and app...
分类:
其他好文 时间:
2014-07-13 19:16:32
阅读次数:
236
Given a binary tree, return the preorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return [1,2,3].
/**
* Definition for bi...
分类:
其他好文 时间:
2014-07-13 18:46:25
阅读次数:
249