Search the pyramid | Sololearn: Learn to code for FREE!
+ 2

Search the pyramid

Given a pyramid of number like this one: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ...... (As you see each number has exactly 2 "children") and a number less or equal to 100, find the number of the row it is on. For exemple if I give you the no 7, your program must return 3 (7 is on the 3rd row from up to bottom)

29th Dec 2017, 12:06 PM
Andrei Cîrpici
Andrei Cîrpici - avatar
4 Antworten
3rd Jan 2018, 2:26 AM
David Ashton
David Ashton - avatar
+ 5
@Andrei U r welcome :)
29th Dec 2017, 3:07 PM
Infinity
Infinity - avatar
29th Dec 2017, 2:39 PM
Infinity
Infinity - avatar
+ 2
thank you!
29th Dec 2017, 2:47 PM
Andrei Cîrpici
Andrei Cîrpici - avatar