Longest common prefix problem

this is a problem of longest common prefix , we have to find the longest common prefix in a array of strings but my solution is not giving output. can u please correct the code

https://ide.geeksforgeeks.org/ycUUYOPWkA

@AbhishekAhlawat1102,

You can use a DP method to solve this or you can use a trie approach.