Right Triangles Leetcode Solution Python