Build Tower
题目
Build Tower
Build Tower by the following given argument:
number of floors (integer and always greater than 0).Tower block is represented as *
Python: return a list;
JavaScript: returns an Array;
C#: returns a string[];
PHP: returns an array;
C++: returns a vector;
Haskell: returns a [String];
Ruby: returns an Array;
Lua: returns a Table;
Have fun!
for example, a tower of 3 floors looks like below
1 | [ |
and a tower of 6 floors looks like below
1 | [ |
思路
确定每行的星号和空格的数量,然后组合到一起,最后组合数组。
答案
1 | function towerBuilder(nFloors) { |

