[Community Puzzle] Highest truncated Pyramid

Hi guys, anyone would have a hint about Validator number 5 (named “Validator 6”)?
Because I pass all tests and the first 4 validators, but not this last… It’s a bit frustrating.

I have a problem with “Validator 2” and “Validator 6”…

Example : I’m not sure what is the good answer for n = 8 ?


or an other figure ?

Just brute-force it.
For n=8, the answer is:



Is truncated, not this one:


What exactly does “truncated” in truncated pyramid mean?

I think what “truncated” means is that you should cut off the top rows of the pyramid if necessary. So for example, if N = 5, the solution is:


I originally failed validators 2 and 6, because my original solution was that I was making the largest truncated pyramid that contained as many bricks as close as possible to N, so for example, for N = 8, my original solution was


but that only contains 7 bricks. If you read the instructions precisely though, it says that your pyramid must have N bricks exactly. So, as nicola1 pointed out, the solution for N = 8 is just a single line of 8 (********), and for any odd number (besides 1), you can always have at least two rows because any odd number N can be the sum of (N/2) + ((N/2) + 1), using integer division.

Even after accounting for that, I’m still failing validator 6. I wish I knew what N was in that case.

1 Like

Like you I was blocked by validator 6, and had the same reasoning.
What helped me to go from 80% to 100% was to think that maybe, for some odd numbers, you may have a pyramid with a shorter basis and a height of 3 or 4 rows …

Like this one for N=27 (just an example) :
| ********
| *********
| **********

which is better than this one :

| *************
| **************

(Ok there is a far better pyramid possible for the number 27 and that’s just an example … but think of way higher numbers that would be in a similar situation and you’ll see how to pass the 6th test ;))


Ah cool, thanks for the hint. I’ll try thinking about this more later.



Supposed to be better for N=27 than only 3 levels one?

Yep I agree. I don’t understand how I have only 80%

It’s not always possible to build the truncated pyramid, isn’t it ? For 1000 bricks I can construct a 999 bricks pyramid. It’s not said what to do in such cases.
So my solution give 100% on test but not 100% on validators…

According to my calculation it is always possible.
1000 bricks can be constructed with the first line 28, continue for 25 lines
999 bricks has first line 9, continue for 37 lines.

Hope that gives you an insight.

Oh you’re right! My mistake: I systematically begin at line 1 then delete some of the first lines

I’m not sure about the “difficult” rating of this puzzle, for me it’s medium at maximum.

I see two problems with the test :

  • the case “only 1 floor of bricks” is only for N=1 in IDE test and N=2 or 4 for validator
  • constraints are N<=1000 but the max used is 76 in validator