![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LintCode刷题
小马透明得像空气
一个计算机专业,为了两个人的未来Fighting!
展开
-
【Lintcode】颜色分类
给定一个包含红,白,蓝且长度为 n 的数组,将数组元素进行分类使相同颜色的元素相邻,并按照红、白、蓝的顺序进行排序。 我们可以使用整数 0,1 和 2 分别代表红,白,蓝。 class Solution { /** * @param nums: A list of integer which is 0, 1 or 2 * @return: n原创 2016-03-21 18:55:49 · 319 阅读 · 0 评论 -
【Lintcode】斐波纳契数列
class Solution { /** * @param n: an integer * @return an integer f(n) */ public int fibonacci(int n) { // write your code here if ( n == 1 ) { return 0; } else if ( n == 2 || n == 3 ) { return 1; } in原创 2016-03-23 16:48:19 · 528 阅读 · 0 评论