Count Good Triplets Leetcode Solution