sTec

  www.stec-inc.com
Work in HR? Unlock Free Profile

sTec Senior Firmware Engineer Interview Question

I interviewed in Santa Ana, CA and was asked:
"Given a cube made of NxN sub cubes, find the number of cubes that are no exposed to the outside."
Add Tags [?]
Answer

Part of a Senior Firmware Engineer Interview Review - one of 11 sTec Interview Reviews

Answers & Comments

0
of 0
votes
6N**2 - 12N + 4
- Interview Candidate on Nov 8, 2010
1
of 1
vote
Let N^2 = n^3
Hence total number of sub-cubes : n^3

Number of cubes on one face : n^2
Total # of cubes/face = 6n^2 - Common cubes
Common cubes = common on the edge + common on the corner
Common on the edge = (n-2) * Number of edges (=12) = 12n - 24
Common on the corner = counted 3 times for neighboring faces. Will need to take into account the 2 extra = 2*number of corners = 2*8

Hence the total number of visible cubes = 6n^2 - 12n + 8
Total number of not visible cubes = n^3 - (visible cubes)

replacing n by N

Soln: N^2 - 6N^(4/3) + 12N^(2/3) - 8
- sum1 on Jan 9, 2011
0
of 0
votes
Its simply :
No. of small cubes in Outer Cube - No. of small cubes in inner cube
n^3 - (n-2)^3 = 6n^2 - 12n + 8 for n >=2
- Gaurav on Jun 16, 2011
1
of 1
vote
The question is for cubes "no exposed to the outside". So the answer is just the count of inner cubes which is
(n-2)^3 for n>=2

But more precisely the question should be "Given a cube made of N^3 sub cubes".
- Simon on Oct 12, 2011

To comment on this question, Sign In with Facebook or Sign Up

Tags are like keywords that help categorize interview questions that have something in common.