title: Find all triplets in array in O(n^2)
body: <p>I am trying to print all triplets in array, unlike 3SUM or anything similiar, they don't satisfy any condition. I just want to print them all.</p>
  
  <p>My simple solution</p>
  
  <pre><code>        for (int i = 0; i &lt; arr.length - 2; i++) {
              for (int j = i + 1; j &lt; arr.length - 1; j++) {
                  for (int k = j + 1; k &lt; arr.length; k++){
                      System.out.println(arr[i] + " " + arr[j] + " " + arr[k]);
                  }
              }
          }
  </code></pre>
  
  <p>runs in <code>O(n^3)</code> with the amount of triplets being <code>((n)*(n-1)*(n-2))/(3!)</code>.</p>
  
  <p>So my question is, can this be done any faster than <code>O(n^3)</code>?</p>