Count Good Triplets Leetcode Solution 9