Sir my code is passing first 3 testcases, but failing in 4 & 5 testcase. Can you please tell what correction do i need to make.
https://ide.codingblocks.com/s/56883
Pythagoras Triplet Ques
Hey, there is no point of using if(st>=100011)
check as because of this your code will not work for large inputs. for eg.
input:
99999993
your code’s output:
-1
but the expected output:
4999999300000024 4999999300000025
Sir then , what stopping condition should i need to give? if i dont give condition if(st>=100011)
then , the compiler is giving TLE.
Hey, that’s the catch, you are not supposed to use the for loop instead try to derive equation for finding the Pythagoras triplets, then it will be done in O(1).