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
时间: 2024-08-09 21:36:37