Pythagorean's challenge

ques link - Question
My Solution

2nd test case is failing.
I could not figure out what’s the mistake…
Please check…

fro what it’s worth, click.

1 Like

I had this approach in mind but I did not implement it because its complexity is O(n^2). I tried using an efficient approach which is O(sqrt(n)) which I have shared in the question above…the sample test case as well as one test case passes on submission but one test case shows WA…I could not figure out the mistake in my code/approach.

The condition is a <= b i.e. a and be can be equal.
e.g. for num=18, the output should be (3,3)

Oh…yeah i missed that…
Thanks…passed the test cases :+1:

1 Like