码迷,mamicode.com
首页 >  
搜索关键字:element    ( 12012个结果
Map, filter and reduce
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
Deleting elements
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
List exercise
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
Some Classical Recursive Functions
Some Classical Recursive FunctionsSome Classical Recursive FunctionsTable of Contents1. Find the maximum element of an array recursively.In this post,...
分类:其他好文   时间:2014-07-13 21:18:30    阅读次数:200
List methods
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
jQuery学习----------DOM操作
DOM操作之创建元素:DOM:varele=document.createElement("element")例子:document.createElement("div")jQuery:var$ele=$("element")//返回的是一个jQuery对象例子:$("<div></div>")DOM操作之输入文本:DOM:vartxt=document.createTextNode("String")例子:doc..
分类:Web程序   时间:2014-07-13 14:16:14    阅读次数:333
LeetCode——Best Time to Buy and Sell Stock III
Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete at most two transactions. Note: You ma...
分类:其他好文   时间:2014-07-13 13:55:14    阅读次数:305
无效的指针、引用和迭代器
首先以示例代码为例: vector v; //添加一些元素 fir(int i=0; i<10; ++i) v.push_back(i); int* my_favorite_element_ptr = &v[3]; cout<<"My favorite element = "<<(*my_favorite_element_ptr)<<endl; cout<<"Its address = "...
分类:其他好文   时间:2014-07-12 18:34:32    阅读次数:250
LeetCode——Best Time to Buy and Sell Stock
Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock),...
分类:其他好文   时间:2014-07-12 17:34:34    阅读次数:170
LeetCode——Best Time to Buy and Sell Stock II
Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy on...
分类:其他好文   时间:2014-07-12 16:31:50    阅读次数:192
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!