Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 449 Bytes

README.md

File metadata and controls

19 lines (13 loc) · 449 Bytes

Pythagorean triplet

Given an array of integers, can you write a function that returns "True" if there is a triplet (a, b, c) within the array that satisfies a^2 + b^2 = c^2.

Examples:

Input: arr[] = {3, 1, 4, 6, 5} 
Output: True 

There is a Pythagorean triplet (3, 4, 5) that exists in the input array.

Input: arr[] = {10, 4, 6, 12, 5} 
Output: False 

There is no Pythagorean triplet that exists in the input array.