human
Check if the sum of a subarray within a given range is a perfect square or not | Function to calculate the square root of the sum of a subarray in a given range.
Calculate the sum of array elements within a given range.
Finding the square root.
If a perfect square is found.
Reduce the search space if the value is greater than sum.
Reduce the search space if the value if smaller than sum.
Driver Code.
Given Array.
Given range.
Function call"
Solution in Python:

Can you provide a code to check if the sum of a subarray within a given range is a perfect square or not and the other steps required?
assistant
#Here is code to check if the sum of a subarray within a given range is a perfect square or not and the other steps required.
 def checkForPerfectSquare ( arr , i , j ) :
	mid , sum = 0 , 0
	for m in range ( i , j + 1 ) :
		sum += arr [ m ]
	low = 0
	high = sum // 2
	while ( low <= high ) :
		mid = low + ( high - low ) // 2
		if ( mid * mid == sum ) :
			return mid
		elif ( mid * mid > sum ) :
			high = mid - 1
		else :
			low = mid + 1
	return - 1
if __name__ == ' _ _ main _ _ ' :
	arr = [ 2 , 19 , 33 , 48 , 90 , 100 ]
	L = 1
	R = 3
	print ( checkForPerfectSquare ( arr , L , R ) )