The Depressed Guy

There is a guy named “Lucky” who is depressed now. His friend Jack knows why he is depressed. He has an array A which contains n numbers. He wants to find the largest sub-array where the first and the last element are same.


This is a companion discussion topic for the original entry at https://toph.co/p/the-depressed-guy