[Challenge] Pyramid building | Sololearn: Learn to code for FREE!
+ 12

[Challenge] Pyramid building

You get a input value i, which stands for the bricks you have. Your challenge is to return a value l which stands for the height of the highest pyramid you can build with the given bricks. Only restriction is that for every stone higher than the ones on the ground there must be 2 on his bottom. eg. input ==> 6 pyramid: # # # # # # output ==> 3 if you have any question or solutions let me know in the comments and leave a like if liked the challenge :) happy coding

8th Oct 2017, 3:31 PM
Chrizzhigh
Chrizzhigh - avatar
17 Respuestas
+ 17
ūüĎČ//try it buddy , & if possible can it be marked as best ūüĎą https://code.sololearn.com/c07WRDN8thIi/?ref=app
8th Oct 2017, 4:38 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 16
seems like i need to modify the code ‚ėļ to handle this edit ::: try my code now ... its modified nowūüėäūüėä
8th Oct 2017, 7:58 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 12
u made 4 # in place of 3 #
8th Oct 2017, 9:47 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 10
if you haven't the right number of bricks you can even build more then one wall... ūüźć https://code.sololearn.com/cz0na4iuyJa4/?ref=app
8th Oct 2017, 5:45 PM
m abrate
m abrate - avatar
9th Oct 2017, 7:54 AM
David Akhihiero
David Akhihiero - avatar
9th Oct 2017, 5:47 AM
David Ashton
David Ashton - avatar
+ 9
Here's an upgraded version, more user-friendly https://code.sololearn.com/c40eXap0ZVx9/?ref=app
9th Oct 2017, 8:44 PM
David Ashton
David Ashton - avatar
+ 7
@Yash Thatte try my code... ūüėä
8th Oct 2017, 7:38 PM
m abrate
m abrate - avatar
+ 7
marking thread
8th Oct 2017, 9:15 PM
David Akhihiero
David Akhihiero - avatar
+ 7
Thanks M Abrate for following me !!!
11th Oct 2017, 10:28 AM
Mattéo
8th Oct 2017, 3:58 PM
Schindlabua
Schindlabua - avatar
+ 6
https://code.sololearn.com/cFSpD3AN7d6k/?ref=app
9th Oct 2017, 11:22 AM
Emma
8th Oct 2017, 4:57 PM
Amr Ibrahim Khudair
Amr Ibrahim Khudair - avatar
+ 5
@GAURAV AGRAWAL just to demonstrate that the leftovers can be placed anywhere and the hight wont increase until its a perfect pyramid again =) but thanks for checking
8th Oct 2017, 10:47 PM
Chrizzhigh
Chrizzhigh - avatar
9th Oct 2017, 6:38 AM
Sketch
Sketch - avatar
+ 4
Ok to clarify : you dont have to build perfect pyramids, you only have to make them the highest without violating the constrains... so for the asked input 7 input ==> 7 pyramid: # ## #### output ==> 3 so most programs are correct by still building perfect pyramids and having left overs... maybe a new challenge will come soon where it is different ;)
8th Oct 2017, 9:43 PM
Chrizzhigh
Chrizzhigh - avatar
+ 3
I know mine doesn't strictly adhere to the rules, but I did it this way so that it would line up. I do, however, have a version that satisfies your rules. https://code.sololearn.com/cPcMEXNjSkEu/#cs
11th Oct 2017, 8:39 PM
Matt Wall
Matt Wall - avatar