title: Find the number of repeated subarray in an array
body: <p>There is an array indexed from <code>0-n</code> (i.e. size=n) containing elements from <code>0-m</code> where <code>m &lt; n</code> (assume m is 100 or 1000 times less than n i.e. m is much less than n), so many of the elements or sub array must be repeated and we have to find the number of such repeated sub array of size 1 or more than 1. For example, consider an array<br>
  <code>1 2 4 1 2 4 1 5 6 3 5</code>, here<br>
  <code>1</code> is repeated 2 times<br>
  <code>2</code> is repeated 1 time<br>
  <code>4</code> is repeated 1 time<br>
  <code>5</code> is repeated 1 time<br>
  <code>1 2</code> is repeated 1 time<br>
  <code>2 4</code> is repeated 1 time<br>
  <code>4 1</code> is repeated 1 time<br>
  <code>1 2 4</code> is repeated 1 time<br>
  <code>2 4 1</code> is repeated 1 time<br>
  <code>1 2 4 1</code> is repeated 1 time<br>
  So the final answer is sum of these i.e. 11<br>
  Can anybody please suggest some data structure or an efficient algorithm to solve this. I was thinking of hashing m and noting the index value where it occurs but didn't formalize it.<br>
  Assume <code>n,m &lt; 10^5</code></p>