• + 3 comments

    I am able to understand your logic. But instead of using the ceil and floor functions I tried saving the sqrt values in int so that the values after decimal is neglected. For example, for [3,10] sqrt(3) gives 1 and sqrt(10) gives 3 when stored in int. Their difference gives the correct answer 2. But it doesn't work in some cases. I am not able to understand what is difference in my logic and the ceil-floor logic. P.S. I included a case if both numbers are equal. Ex [4,4] so it is certainly not an issue.