less than 1 minute read

Given a list of positive integers nums, return whether there exist integers a, b, and c such that a ** 2 + b ** 2 = c ** 2.

Constraints

  • 0 ≤ n ≤ 1,000 where n is the length of nums

https://binarysearch.com/problems/Pythagorean-Triplets

Examples

Example 1

Input

  • nums = [5, 1, 7, 4, 3]

Output

  • answer = True

Explanation

3, 4, 5 are in the array and 3^2 + 4^2 = 5^2.

Solution

Categories:

Updated:

Leave a comment