首页 > 其他 > 详细

关于codehunt Level 02.01 的疑问

时间:2014-06-05 10:05:19      阅读:260      评论:0      收藏:0      [点我收藏+]

codehunt Level 02.01 原题大意如下 :

假设给定下列函数声明

public static int[] Puzzle(int n) { 
        return null;
    }

要求写出该方法具体函数代码,返回值应为下列类似的值

n           值
1           {0}                     
2           {0,  1}
3           {0, 1,  2}

我写的如下方法

public static int[] Puzzle(int n) {
		int[] re = new int[n];
		for (int i=0; i<n; i++) re[i] = i;
        return re;
    }

结果只得了1个黄色的方块(总分是3个黄方块)。


请问:有人能说明一下为什么只得1个方块,是效率不高?还是其它什么原因?

关于codehunt Level 02.01 的疑问,布布扣,bubuko.com

关于codehunt Level 02.01 的疑问

原文:http://blog.csdn.net/darkinger/article/details/27493967

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!