Count Good Triplets in an Array — CaffeCode