Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

05 - shapeArea #46

Closed
Tracked by #40
ValdineiJunior opened this issue Apr 26, 2023 · 0 comments
Closed
Tracked by #40

05 - shapeArea #46

ValdineiJunior opened this issue Apr 26, 2023 · 0 comments

Comments

@ValdineiJunior
Copy link
Owner

ValdineiJunior commented Apr 26, 2023

05 - shapeArea

Below we will define an n-interesting polygon. Your task is to find the area of a polygon for a given n.

A 1-interesting polygon is just a square with a side of length 1. An n-interesting polygon is obtained by taking the n - 1-interesting polygon and appending 1-interesting polygons to its rim, side by side. You can see the 1-, 2-, 3- and 4-interesting polygons in the picture below.

Example

For n = 2, the output should be
solution(n) = 5;
For n = 3, the output should be
solution(n) = 13.

Click here - and see my solution in replit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant