longest repeated subset of array elements in given array <p>Hi i have a question about jquery, i need to find the longest repeated subset from a given array.</p> <p>Example: </p> <p><code>my_array['b','r','o','w','n','f','o','x','h','u','n','t','e','r','n','f','o','x','r','y','h','u','n']</code></p> <p>the result should be nfox. I have the following code:</p> <pre><code> string = my_array.join(''); for(i=0; i &lt; my_array.length; i++) { for(j=0; j &lt; my_array.length; j++) { string.substring(Math.abs(j-i)); } } </code></pre> <p>but it doesn't seems to work like i wanted maybe i'm missing some jquery function ?</p>