5 kyu
Castle of Cubes
Description:
Castle of Cubes:
You've been hired by a castle building company.Their procedure is very simple : In their castles, all the rooms are the same cube.
They build thousands of the same square stone panels, and assemble them (ground,walls,ceiling).
Neighboring rooms share one same panel between them.
Business is growing fast, so they need your help:
the customer has only one variable: 'n', the number of rooms.
For energy saving reasons, the surface of the castle must be minimum for any given 'n'.
Multiple floors are possible.
You must write a code to find the number of panels that will be needed for a 'n' castle.
(Optimised solution is needed: there are 100 000+ tests, in a range from 0 to 10^18)
ex:
n - pannels:
0 - 0
1 - 6
2 - 11
36 - 141
37 - 146
Algorithms
Similar Kata:
Stats:
Created | Apr 21, 2019 |
Published | Apr 26, 2019 |
Warriors Trained | 264 |
Total Skips | 13 |
Total Code Submissions | 758 |
Total Times Completed | 32 |
Python Completions | 32 |
Total Stars | 19 |
% of votes with a positive feedback rating | 100% of 13 |
Total "Very Satisfied" Votes | 13 |
Total "Somewhat Satisfied" Votes | 0 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 3 |
Average Assessed Rank | 4 kyu |
Highest Assessed Rank | 4 kyu |
Lowest Assessed Rank | 6 kyu |