Informatica Interview Question
Software Engineer / DevelopersCountry: India
Interview Type: Phone Interview
n=1 is a special case.
for n=1, hollow=solid=1 cube.
for n>=2, solid = n^3 , hollow=n^3 - (n-2)^3.
for solid cube n^3 unit cubes make for solid cube of side n
and
for hollow cube: a solid cube of side (n-2) is removed from inside of the solid cube of side n.
Another method for hollow: 6*(1000^2) -12*1000 + 8
area of one side (1000^2) * number sides(6)
-
size of side (1000) * shared edges(12)
+
restore shared corners (8)
1000^3 small cubes if you need solid
- loveCoding June 14, 20121000^3 - 998^3 if you need hollow