
CodingBat
cunane
千里之行,始于足下。
展开
-
CodingBat | make_bricks
链接:Make bricks问题 思路:先尽可能多地使用大的,再使用小的 1)用了多少块大的:min(big, goal / 5) 2)还需要多少块小的:goal - 5 * min(big, goal / 5) def make_bricks(small, big, goal): if goal / 5 <= big: return goal % 5 <= sm...原创 2020-02-01 04:30:41 · 396 阅读 · 0 评论 -
【CodingBat】 squareUp问题
问题描述:squareUp问题 Given n>=0, create an array length n*n with the following pattern, shown here for n=3 : {0, 0, 1, 0, 2, 1, 3, 2, 1} (spaces added to show the 3 groups). squareUp(3...原创 2019-01-17 16:06:54 · 313 阅读 · 0 评论