Trinity Life Sciences interview question

They asked the question in Array and Reducing the elements in array