SpanIdea interview question

Calculate sum of array using generator.