Here is a Python one liner,
side_len = lambda a, b: [c for c in range(abs(b-a) + 1, b+a) if not (lambda arr: arr[0] + arr[1] == arr[2])(sorted([a*a, b*b, c*c]))]
And here is the detailed version of above,
def checkPythagorean(a: int, b: int, c: int) -> bool: arr = sorted([a*a, b*b, c*c]) return arr[0] + arr[1] == arr[2] def side_len(a: int , b: int) -> list: lst = [] for c in range(abs(b-a)+1, b+a): if not checkPythagorean(a, b, c): lst.append(c) return lst
Outputs
print(side_len(1, 1)) # output -> [1] print(side_len(3, 4)) # output -> [2, 3, 4, 6] print(side_len(4, 6)) # output -> [3, 4, 5, 6, 7, 8, 9] print(side_len(5, 12)) # output -> [8, 9, 10, 11, 12, 14, 15, 16] print(side_len(8, 10)) # output -> [3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Here is a Python one liner,
And here is the detailed version of above,
Outputs