Samsara Interview Question

1. Given an array of numbers construct the array of numbers with the rules given. 2.