Right Triangles Leetcode Javascript Practice