DEV Community

Discussion on: The challenge to make a shape area calculation in CodeSignal

Collapse
 
xerghos profile image
Xerghos

I think this is more appropriate:

function shapeArea(n) {
return (1 + (n-1)*n) *2 - 1
}

Collapse
 
fromchiapasdev profile image
Axel Espinosa

Hey buddy, can you explain your solution?

Collapse
 
trungsusi97 profile image
TrungSuSi97

Why do you think that formula ?

Thread Thread
 
fromchiapasdev profile image
Axel Espinosa

Did you solve it?