gpt4 book ai didi

algorithm - 制作特定尺寸长方体的方法数量

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:16:11 24 4
gpt4 key购买 nike

我在面试中被问到这个问题。除了考虑所有可能性之外,我想不出一种方法——即完全蛮力。

You have 3 kind of cubes 1×1×1, 1×2×1, and 1×1×2. How many ways can you make a cube of dimension 1×2n×k using the above types of cubes?

最佳答案

为了减少这个问题,我删除了一个常量维度。

this question is simple:

we have 2 kind of 1*1,1*2 Squares,

HOW MANY WAYS you can make a Square of dimension 2^n X k using the above type of Squares?

这个问题等于:多少matchingLattice graph大小为 2^n X k?

因为对于每一场比赛,我们都有一个模式来填充我们的广场,即边缘匹配的集合(1*2 广场)。对于其他广场集(1*1 广场)

我猜Matching polynomial & Bipartite graph很有用。

同题(n=1)可以用递归函数求解,很容易证明结果在fibonacci_number之间。和 Catalan_number (有关更多详细信息,请参阅 this link 中的斐波那契数和砖墙模式)

关于algorithm - 制作特定尺寸长方体的方法数量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13827279/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com