摘要: ## 阐述 请把纸条竖着放在桌⼦上,然后从纸条的下边向上⽅对折,压出折痕后再展开。此时有 1 条折痕,突起的⽅向指向纸条的背⾯,这条折痕叫做“下”折痕 ;突起的⽅向指向纸条正⾯的折痕叫做“上”折痕。如果每次都从下边向上⽅ 对折,对折 N 次。请从上到下计算出所有折痕的⽅向。 给定折的次数 n,请返回从上到下的折痕的数组,若为下折痕则对应元素为"down",若为上折痕则为"up". ## 样例... 阅读全文
posted @ 2020-09-27 21:29 oceans-pro 阅读(173) 评论(0) 推荐(0) 编辑
摘要: ## 实现 借助队列实现 ```js function Tree(num) { this.num = num this.subs = [] } Tree.prototype.add = function (item) { this.subs.push(item) } function orderTree(t0, cb) { let arr = [] arr.push(t0) ... 阅读全文
posted @ 2020-09-27 18:54 oceans-pro 阅读(715) 评论(0) 推荐(0) 编辑