ProblemGiven two integers a and b with 1 ≤ a ≤ b, count the perfect squares in…
PYQ Wipro NLTH / Elite 2024
Problem
Given two integers a and b with 1 ≤ a ≤ b, count the perfect squares in the inclusive interval [a, b]. A perfect square is an integer of the form k2 for some non-negative integer k.
Input format
One line containing two space-separated integers a and b.
Output format
Print one integer: the number of perfect squares between a and b, inclusive.
Constraints
1 ≤ a ≤ b ≤ 100000
Sample 1
Input
3 8
Output
1Explanation: 4 is the only perfect square in [3, 8].
Sample 2
Input
9 25
Output
3Explanation: 9, 16, and 25 are the perfect squares in [9, 25].
Attempted by 9 students.
Sign up free to check your answer
Sign up freeLoading lesson…

