Count Possible Triangles Leetcode Javascript Practice