• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
November 04, 2023 |2.1K Views
PROBLEM OF THE DAY: 03/11/2023 | Pythagorean Triplet
Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Karan Mashru. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Programming Logic but will also help you build up problem-solving skills.

In this video, we are given, an array arr of n integers, and write a function that returns true if there is a triplet (a, b, c) from the array (where a, b, and c are on different indexes) that satisfies a2 + b2 = c2, otherwise return false.

Example :

Input:
N = 5
Arr[] = {3, 2, 4, 6, 5}

Output: Yes

Explanation: a=3, b=4, and c=5 forms a pythagorean triplet

Give the problem a try before going through the video. All the best!!!
Problem Link: https://practice.geeksforgeeks.org/problems/pythagorean-triplet3018/1
Solution IDE Link: https://ide.geeksforgeeks.org/online-cpp-compiler/01ec9ddd-395c-4e3e-8a5c-54a48956463f

Read More