yield关键字用于遍历循环中,yield return用于返回IEnumerable,yield break用于终止循环遍历。 有这样的一个int类型的集合: static List GetInitialData() { return new List(){1,2,3,4}; }需要打印出所有值大...
分类:
其他好文 时间:
2014-07-12 00:06:38
阅读次数:
290
语言:Python描述:使用递归实现 1 class Solution: 2 # @return an integer 3 def numTrees(self, n): 4 if n == 0: 5 return 0 6 eli...
分类:
其他好文 时间:
2014-07-11 23:44:08
阅读次数:
216
1.获取当前时间1 function getNowTime() {2 return new Date();3 }2.时间与天数相加1 function getTimeAddDays(time, days) {2 return new D...
分类:
其他好文 时间:
2014-07-11 23:18:27
阅读次数:
183
function repeat(str, count) { return count '; }; document.write(s);}diamond('A', 5);
分类:
Web程序 时间:
2014-07-11 23:17:14
阅读次数:
213
1. 改变符号:取反+12. 与0异或保持不变,与-1(0xffffffff)异或相当于取反。3. 负数右移可以认为是补符号位(当然也有机器不是这样子)。负数右移31位就是-1. 1 int sign(int n) { 2 return ~n + 1; 3 } 4 5 int abs(in...
分类:
其他好文 时间:
2014-07-11 21:15:56
阅读次数:
289
Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100"class Solution {public: string addBinary(stri...
分类:
其他好文 时间:
2014-07-11 20:05:47
阅读次数:
224
public class GameTree {/*** 推断剩余球数,谁能取到最后谁赢,* ,一人取一次,默认我方先取,,是否能必胜,能就返回true,否则false* @param x剩余球数* @return*/static boolean f(int x){int[] op={1,3,7,8}...
分类:
其他好文 时间:
2014-07-11 18:48:55
阅读次数:
180
引自:http://www.w3cplus.com/css/front-end-web-development-quiz.htmlQ7:下面代码弹出值是什么?x = 1;function bar() { this.x = 2; return x;}var foo = new bar();...
分类:
Web程序 时间:
2014-07-11 12:37:11
阅读次数:
222
http://blog.csdn.net/andyxm/article/details/5219919我们引用本地flash,实现flash与js双向交互。 function thisMovie(movieName) { if (window.document[movieName]){ return...
分类:
Web程序 时间:
2014-07-11 11:53:44
阅读次数:
175
Notice:Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.For example:Input: ["tea","an....
分类:
其他好文 时间:
2014-07-10 14:44:00
阅读次数:
179