Category Archives: C++ Programs

Pythagorean Triplet in an array using STL

Given an array of integers, write a function that returns true if there is a triplet (a, b, c) that satisfies a2+b2=c2 Example: Input: arr[] = {8, 1, 4, 6, 10} Output: True There is a Pythagorean triplet (8, 6, 10). Input: arr[] = {1, 2, 4, 3} Output: False There is no Pythagorean triplet. Approach: The problem… Read More »