8 kyu
Count the number of cubes with paint on
4,492 of 12,271jackchambers
Description:
Upon arriving at an interview, you are presented with a solid blue cube. The cube is then dipped in red paint, coating the entire surface of the cube. The interviewer then proceeds to cut through the cube in all three dimensions a certain number of times.
Your function takes as parameter the number of times the cube has been cut. You must return the number of smaller cubes created by the cuts that have at least one red face.
To make it clearer, the picture below represents the cube after (from left to right) 0, 1 and 2 cuts have been made.
Examples:
If we cut the cube 2 times, the function should return 26
If we cut the cube 4 times, the function should return 98
Puzzles
Similar Kata:
Stats:
Created | Jun 17, 2016 |
Published | Jun 17, 2016 |
Warriors Trained | 27311 |
Total Skips | 662 |
Total Code Submissions | 37651 |
Total Times Completed | 12271 |
JavaScript Completions | 4426 |
Ruby Completions | 423 |
Python Completions | 4492 |
C# Completions | 822 |
Shell Completions | 276 |
C++ Completions | 1241 |
Reason Completions | 23 |
C Completions | 439 |
Haskell Completions | 144 |
Julia Completions | 39 |
NASM Completions | 28 |
SQL Completions | 631 |
TypeScript Completions | 142 |
Factor Completions | 11 |
Dart Completions | 165 |
Scala Completions | 13 |
CoffeeScript Completions | 13 |
Total Stars | 264 |
% of votes with a positive feedback rating | 83% of 1537 |
Total "Very Satisfied" Votes | 1150 |
Total "Somewhat Satisfied" Votes | 240 |
Total "Not Satisfied" Votes | 147 |