Shopee interview question

Recursion question on an 1D array