7 kyu
Painted Sides
165 of 256anusha.j
Description:
Task
You are given a big cube, made up of several little cubes. You paint the outside of the big cube and are now supposed to find out how many of the little cubes have zero faces painted, one face painted, two faces painted, etc.
Write a function which accepts two parameters:
length
: the side length of the big cube (in little cubes),0 <= length <= 50
n
: the number of faces painted,0 <= n <= 7
You have to figure out how many of the little cubes have n
faces painted.
Example
painted_faces(4,3)
=> result: 8 # Only the vertices of the big cube will have three faces painted
If n > 3
then return 0
as it is not possible for a painted cube to have more than 3
sides painted (unless s == 1
, in that case it will have 6
faces painted).
Mathematics
Logic
Puzzles
Similar Kata:
Stats:
Created | Mar 4, 2024 |
Published | Mar 4, 2024 |
Warriors Trained | 723 |
Total Skips | 14 |
Total Code Submissions | 1435 |
Total Times Completed | 256 |
Python Completions | 165 |
C Completions | 33 |
λ Calculus Completions | 4 |
Haskell Completions | 25 |
JavaScript Completions | 64 |
Total Stars | 12 |
% of votes with a positive feedback rating | 91% of 57 |
Total "Very Satisfied" Votes | 48 |
Total "Somewhat Satisfied" Votes | 8 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 18 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 8 kyu |