该题目来源于twitter公司 2013年面试题
Deion:(Make a spiral)
Your task, is to create a NxN spiral with a given size.(您的任务是创建一个给定大小的NxN螺旋。)
For example, spiral with size 5 should look like this:(例如,大小为5的螺旋应如下所示:)
and with the size 10:(尺寸为10:)
Return value should contain array of arrays, of 0 and 1, for example for given size 5 result should be:(返回值应包含数组数组,为0和1,例如给定大小为5的结果应为:)
Because of the edge-cases for tiny spirals, the size will be at least 5.(由于微小螺旋的边缘,尺寸将至少为5。)
General rule-of-a-thumb is, that the snake made with '1' cannot touch to itself.(一般的大拇指是,用'1'做的蛇不能碰到自己。)
本期答案:
欢迎大家踊跃回答,把您认为最简洁、高效、有趣的答案,发送到猿助猿后台!与小编互动即有机会获得价值不菲的精美礼品哦~赶紧“躁”起来吧!
觉得本文有帮助?请分享给更多人
关注「猿助猿」成就顶级开发
技术交流QQ群:517877452
我来说两句排行榜