Unique prefix array implementation code

I am unable to implement this using the required knowledge, so provide me with the code of this topic

Code:

let me know if u have doubt.

please share the code iam not getting it though