We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
This is a pretty intense combinatorial problem. For the record just figuring out all of the ways to stack n number of 1x2 lego bricks contiguously is itself a deep theoretical math question for mathemeticians, and only has a theorem that was proven in 1988.
Even attempting to brute force the solution is itself a challenge to write, let alone something reasonably efficient. I think if any company expected you to do this problem I would ask if any of their engineers could solve it provided you make a small tweak to the parameters.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Lego Blocks
You are viewing a single comment's thread. Return to all comments →
This is a pretty intense combinatorial problem. For the record just figuring out all of the ways to stack n number of 1x2 lego bricks contiguously is itself a deep theoretical math question for mathemeticians, and only has a theorem that was proven in 1988.
Even attempting to brute force the solution is itself a challenge to write, let alone something reasonably efficient. I think if any company expected you to do this problem I would ask if any of their engineers could solve it provided you make a small tweak to the parameters.