Woodstock Blog

a tech blog for general algorithmic interview questions

[Apple] Calculate Area

Question

Calculate area:

Analysis

We are only able to come up with 2 equations using the obvious relationship between semicircle and square. But we have x, y and z variables.

How do we proceed?

Solution

Thanks to my girlfriend, who came up with the solution:

The tiny small shaded area can be calculated by substracting the isosceles triangle (等腰三角形) from a 1/12 circle.

And the tiny small shaded area is simply a part of the larger shaded area.

Do you own math.