
算法题
arwind gao
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
使用递归算法求1,1,2,3,5...斐波那契数列第N个数的值
这道题非常简单,只需要使用一个简单的递归即可得到结果: 规律为从第三个数开始: F(n) = F(n-1) + F(n-2) C#代码: public int Foo(int n) { if (n == 0) { return 1; }原创 2012-05-17 16:49:49 · 10167 阅读 · 0 评论 -
有类似数组(1,2,3,1,1), 若相同元素大于一半以上则输出True, 反之返回False. (可不必输入具体值)
这道题需要使用一个中介Dictionary存储相同元素的值的个数, 并且输出: int[] source = new int[]{1,2,3,1,1}; int flag = source/2; if(source.length%2 == 1) flag += 1; Dictionary list = new Dictionary(); foreach(int ele in原创 2012-05-23 00:37:27 · 1194 阅读 · 1 评论 -
C#编程中常用统计学公式
Being able to apply statistics is like having a secret superpower. Where most people see averages, you see confidence intervals. When someone says “7 is greater than 5,” you declare that they're rea转载 2013-05-27 14:07:33 · 2975 阅读 · 0 评论