UNique Prefix Subarray

I tried implementing code but i am getting an error that i dont understand

i have made some changes to your code and added comments please check