Given an array of String containing the dimensions to create a figure, we have to calculate the area of the figure created from the string array.

**Example :** If the string array contains {“N2” , “E2” , “S2” , “W2”}

N -> North E->East and so on.

The above array represents a square with side 2.

Similarly any figure can be created with at most 12 corners and assume that we always end on the corner on which we started.

I used 2-D matrix to first create the figure using 1s and 0s and then calculated the area.

Is there any better approach to solving this problem as my program gives wrong answer for one case?

The exact question can be found here :

http://icpc.baylor.edu/ICPCWiki/attach/Problem%20Resources/1974-Texas.pdf