title: Remove two or more consecutive numbers ending in 6 in the array
body: <p>I have tried it but it is working only for two consecutive digits and not for more than two. Please find the code below which I've tried and kindly suggest a solution for it.</p>
  
  <p>Sample Input:</p>
  
  <p>3
  6
  36
  62
  121
  66
  26
  376
  661
  6</p>
  
  <p>Sample Output:</p>
  
  <p>3
  62
  121
  661
  6</p>
  
  <p>My code:</p>
  
  <pre><code>public static List&lt;Integer&gt; processArray(ArrayList&lt;Integer&gt; array) {
      int num=0;
      int prevnum=0;
     for(int i =0;i&lt;array.size();i++) {
         num=array.get(i);
         if(i&gt;0 &amp;&amp; array.get(i-1)%10==6 &amp;&amp; num%10==6) {
            array.remove(i-1);
            array.remove(i-1);
         }
     }
      return array;
  }
  </code></pre>