X

DAYS

:

HOUR

:

MINS

:

SEC

Copied to Clipboard
Right angled triangles
Easy Accuracy: 57.44% Submissions: 122 Points: 2

Given three integers a, b and c. The task is to check if it is possible to make right angled triangle with sides of length a, b and c.

 

Example 1:

Input:
a = 3, b = 4, c = 5
Output:
Yes
Explanation:
We can form a right angled triangle
with sides of length 3, 4 and 5.

Example 2:

Input:
a = 2, b = 5, c = 8
Output:
No
Explanation:
We can't form a right angled triangle
with sides of length 2, 5 and 8.

 

Your Task:
You don't need to read input or print anything. Your task is to complete the function rightAngTri() which takes 3 Integers a,b and c as input and returns "Yes" if it is possible to form a right angled triangle with sides of length a, b, and c, else return "No".

 

Expected Time Complexity: O(log(max(a,b,c)))
Expected Auxiliary Space: O(1)

 

Constraints:
1 <= a,b,c <= 108

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Right angled triangles

Output Window