Pregunta de entrevista de Samsung Electronics

Calculate area type algorithm question.