title: Find the number of times a number is repeated in an array in less than O(n^2)
body: <p>Sample code that I have written.But this is n^2</p>
  
  <pre><code>int a[]={1,4,1,5,2,2,4,3,4,1};
  int b[][]=new int[5][2];
  int i,j,k=0,count=1;
  boolean temp=false;
  for(i=0;i&lt;a.length;i++)
  {
      for(j=0;j&lt;5;j++)
      {
          if(a[i]==b[j][0])
          {   temp=true;
              b[j][1]++;
              break;
          }
      }
  
      if(temp==false)
      {
          b[k][0]=a[i];
          b[k][1]=1;
          k++;    
      }
      temp=false;
  }
  for(i=0;i&lt;5;i++)
  {
      for(j=0;j&lt;1;j++)
      {
      System.out.println(b[i][j]+" is repeated "+b[i][j+1]+" times");
      }
  }
  </code></pre>