HCLTech interview question

recursion question and array related question