// check if three integers a, b, c can form a right triangleboolpythagoreanTriplet(inta,intb,intc){return(a*a+b*b==c*c)||(a*a+c*c==b*b)||(c*c+b*b==a*a);}// returns a vector of all the possible third side lengths// without right triangles in increasing ordervector<int>side_len(inta,intb){vector<int>thirdSide;intstart=abs(b-a)+1;intend=b+a-1;for(inti=start;i<=end;i++){if(!pythagoreanTriplet(a,b,i))thirdSide.push_back(i);}returnthirdSide;}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
C++ solution